OBJECTIVES: To identify all patients with diabetes in a community using electronic record linkage of multiple data sources and to compare this method of case ascertainment with registers of diabetic patients derived from primary care. DESIGN: Electronic capture-recapture linkage of records included data on all patients attending hospital diabetes clinics, all encashed prescriptions for diabetes related drugs and monitoring equipment, all patients discharged from hospital, patients attending a mobile unit for eye screening, and results for glycated haemoglobin and plasma glucose concentrations from the regional biochemistry database. Diabetes registers from primary care were from a random sample of eight Tayside general practices. A detailed manual study of relevant records for the 35,144 patients registered with these eight general practices allowed for validation of the case ascertainment. SETTING: Tayside region of Scotland, population 391,274 on 1 January 1996. MAIN OUTCOME MEASURES: Prevalence of diabetes; population of patients identified by different data sources; sensitivity and positive predictive value of ascertainment methods. RESULTS: Electronic record linkage identified 7596 diabetic patients, giving a prevalence of known diabetes of 1.94% (0.21% insulin dependent diabetes, 1.73% non-insulin dependent): 63% of patients had attended hospital diabetes clinics, 68% had encashed diabetes related prescriptions, 72% had attended the mobile eye screening unit, and 48% had biochemical results diagnostic of diabetes. A further 701 patients had isolated hyperglycaemia (plasma glucose > 11.1 mmol/l) but were not considered diabetic by general practitioners. Validation against the eight general practices (636 diabetic patients) showed electronic linkage to have a sensitivity of 0.96 and a positive predictive value of 0.95 for ascertainment of known diabetes. General practice lists had a sensitivity of 0.91 and a positive predictive value of 0.98. CONCLUSIONS: Electronic record linkage was more sensitive than general practice registers in identifying diabetic subjects and identified an additional 0.18% of the population with a history of hyperglycaemia who might warrant screening for undiagnosed diabetes.