Tom, the easiest way is to use a parameterized view as Garry suggested. You set up your view, and in the FILTER tab you put
drname = ?v_drname
Now "v_drname" is a variable which the view will look for whenever it is queried. So in your case you would have the code:
v_drname = thisform.Mycombo.value
sele MyView
requery()
Simple to implement.
If you really need to use a SQL-Select instead of a view, you may need to write out the 'where' clause with extra quotes around the variable:
MyFilter = "drname = '" + thisform.combo1.value + "'"
Select ..... where &MyFilter
Notice how I put a single quote inside the double quotes that defined the text so the final string will have single quotes around the variable name.
HTH
Barbara
>I have a form that has a combo box and a command button. The combo box references a table called 'doctors' for example. The table has a field called drname which is displayed in a dropdown combo box.
>The command button under command1.click runs a query to search the drname field for the highlighted name in the combo box. How do I tell the query under command.click which name is currently highlighted in the combo box?
>I've tried referincing the combo box in the query by--
>Under command.click I placed:
>
>'vdrnam = thisform.combo1.value'
>
>then my query filter says:
>
>'where drname = m.vdrnam'
>
>Any suggestions on what else I could try?