Objective: To evaluate the relation between topically applied non-steroidal anti-inflammatory drugs and upper gastrointestinal bleeding and perforation. Design: A case-control study with 1103 patients admitted to hospital for upper gastrointestinal bleeding or perforation between January 1990 and December 1992 (cases). Two different control groups were used, with six community controls and with two hospital controls for each case. Previous exposure to topical and oral non-steroidal anti-inflammatory drugs and ulcer healing drugs was assessed. Study population-The population of 319465 people who were resident in Tayside and were registered with a Tayside general practitioner between January 1989 and October 1994. A record linkage database containing all data on hospital events and dispensed drugs between 1989 and 1992 was used for this population. Main outcome measures: Unadjusted and adjusted odds ratios of exposure in those admitted to hospital compared with controls. Results: Significant unadjusted associations were detected between all three classes of drug and upper gastrointestinal complications. The significant association detected for topical non-steroidal anti-inflammatory drugs was no longer evident in analyses which adjusted for the confounding effect of concomitant exposure to oral anti-inflammatories and ulcer healing drugs (odds ratio=1.45; 95% confidence interval 0.84 to 2.50 with community controls; 1.06; 0.60 to 1.88 with hospital controls). Conclusion: In this study topical non-steroidal anti-inflammatory drugs were not significantly associated with upper gastrointestinal bleeding and perforation after adjustment for the confounding effects of concomitant use of oral anti-inflammatories and ulcer healing drugs.