View Full Version : Select record in List Box (or Combo Box) using code only


chuckgoss
08-21-2001, 10:59 AM
Hi all,
I am at my witts end in trying to figure out how I can select a record from a list box without using a mouse or keyboard command. In my box, there is either 0 records found or 1 record found (there will never be more than 1 found). I requery the box on GotFocus, and I use KeyDown to launch an If statement, which looks at the result of the query. Works great if I select the record in the box with a mouse. I have tried a combo box that automaticly drops down with success, but that's also when I use a mouse click.
Any Ideas?

chuck

Liv Manto
08-21-2001, 05:18 PM
DO you really have to use list box if your record could never be more than one? Why not textbox?

chuckgoss
08-22-2001, 09:44 AM
Liv,
Thanks for the quick reply. I suppose I don't have to use a list or combo box. I read and printed a thread from 8/15 that shows how to requery a textbox, but I know I'm missing something. It said that I could save the record and then write MyTextBox.Requery in my code. Where would I run my query from? I'm guessing that the text box would be bound, but, naturally, it would be bound to my table and I don't know how to get it to show a result of a qeury? My form has 1 other combo box which selects an initial record. There are 2 unbound textboxes that contain criteria that my 2nd "query" looks at in order to correctly run- ('is there a partnumber' and 'at that location').

thanks in advance,
chuck