What to prescribe for a patient in general practice when the choice of treatments has a limited evidence base? Tjeerd-Pieter van Staa and colleagues argue that using electronic health records to enter patients into randomised trials of treatments in real time could provide the answer