The study investigated whether the DRD4 and COMT genes can modify relations between trait anxiety and selective attention. Two hundreds and sixty-six subjects performed a visual search task in which they had to find words looking through a sheet with rows of letters. After finishing the first sheet the subject was presented the second one, this time with an instruction to perform the task as quickly and accurate as possible. To study top-down attention, the number of correctly identified words (accuracy) and the time for completion of each trial were analyzed. To study bottom-up attention, the letters ‘o’ and ‘n’ were written in green, whilst the others were in black, and subjects were asked whether they had noticed that 2–3 minutes after the task completion. Genotypes for the COMT Val158Met and DRD4 VNTR-48 polymorphisms and TCI Harm Avoidance and MMPI Depression scales’ scores were obtained as well. High anxious individuals showed a more pronounced increase in accuracy in the second trial and more profound processing of irrelevant stimuli (colored letters). There was a significant interaction effect of DRD4 and Harm avoidance on the accuracy dynamics F(1, 210), = 7.65, p = .006, η2 = .04. Among DRD4 long allele carriers, high anxious subjects significantly improved accuracy (p = .013) and tended to slow speed, while those with lower Harm avoidance demonstrated the opposite trend. These effects were more robust in less educated individuals. It was concluded that the DRD4 polymorphism may modify the influence of trait anxiety on the speed-accuracy tradeoff.