This retrospective cohort study examined quality of care for diabetes in a large national network of electronic health record users. Of 10572 patients with diabetes included in the study, 55% had at least 2 hemoglobin A1c (HbA1c) tests, 95% had at least 1 systolic and diastolic blood pressure test, and 52% had at least 1 low-density lipoprotein (LDL) cholesterol test over a 1-year period. Of those tested, 41% had an HbA1c<7.0, 28% had a blood pressure<130/80 mm Hg, and 44% had an LDL cholesterol level<100 mg/dL. Of those not adequately controlled, 99% were prescribed hypoglycemic medications, 85% were prescribed antihypertensive medications, and 71% were prescribed lipid-lowering medications. These results suggest that there is significant room for improvement in testing and control of risk factors for persons with diabetes and that the electronic health record has a significant potential for conducting practice-based quality-of-care studies across large numbers of outpatient practices.