Subgroup analyses showed that the association of cancer with subsequent dementia risk was more pronounced in older people, males, non-carriers of ApoE4, and those with higher BMI. Here, APOE is linked to cancer.