Previously published studies reported an increased risk of gastrointestinal illness in the 14 days following trivalent influenza vaccination (TIV) in young children. While gastrointestinal illness may be a true adverse effect of TIV, other factors may influence this observed association, such as seasonal illness patterns and children being exposed to gastrointestinal pathogens at medical visits. The objective of this study was to examine factors influencing the association between TIV and gastrointestinal illness. Specifically, using data from a previous influenza vaccine safety study, we examined the association between medical encounters without TIV and gastrointestinal illness. Using electronic health record (EHR) data from 6 managed care organizations (MCOs), we identified medically attended gastrointestinal illness cases among children 24-59 months in the 2002-2006 influenza seasons. We matched each case to four controls on sex, birthdate (month/year), MCO, influenza season, and presence of a chronic condition. We then looked 1-14 days prior to the index date (gastrointestinal illness diagnosis date) to determine whether the child had a medical encounter. We excluded previous medical encounters with gastrointestinal-related diagnoses or TIV. Conditional logistic regression was used to calculate odds ratios and 95% confidence intervals. We identified 2062 gastrointestinal illness cases and matched them to 8248 controls. We observed increased odds of gastrointestinal illness within 14 days after a medical encounter (odds ratio=1.9; 95% confidence interval [CI]: 1.7-2.2) among children without chronic conditions. Among children with chronic conditions, the odds ratio was 3.9 (95% CI: 2.5-6.2). We demonstrated that another exposure related to vaccination, medical visits, is also associated with increased odds for gastrointestinal illness. This study highlights challenges of interpreting results from observational vaccine safety studies when there are co-occurring exposures, and the importance of investigating confounding in EHR data, which are an essential resource for vaccine safety research.