putting a combo box in a pop-up window

M

mnance

I have a query in my database that searches for a particular name. I created this query by putting brackets [] into the criteria cell in the query design window. When i run this query a pop-up window appears that says "Enter parameter value". Into the window i have to type the name exactly as it appears in the record. i would like to have a combo box in this pop-up window that would automatically complete the name as i start typing it. Is there anyway to do that, or is there a better way to build my query so that would be possible?
 
K

Ken Snell

Use a form to obtain the desired value and then have the query read the
value from the form.

Replace the parameter in the query with an expression similar to the
following (substitute your real names):

[Forms]![myFormName]![myComboBoxName]

where myFormName is the name of the form and myComboBoxNameis the name of
the combobox that has the desired value.

On your form, put the combo box and a command button. Have the combo box's
Row Source return all the values that you want to select from. Then put code
on the command button's OnClick event to run the query (or to open a report,
if that is what the query will "feed"):

Private Sub CommandButtonName_Click()
DoCmd.OpenQuery "QueryName"
End Sub


or

Private Sub CommandButtonName_Click()
DoCmd.OpenReport "ReportName"
End Sub


--
Ken Snell
<MS ACCESS MVP>



mnance said:
I have a query in my database that searches for a particular name. I
created this query by putting brackets [] into the criteria cell in the
query design window. When i run this query a pop-up window appears that
says "Enter parameter value". Into the window i have to type the name
exactly as it appears in the record. i would like to have a combo box in
this pop-up window that would automatically complete the name as i start
typing it. Is there anyway to do that, or is there a better way to build my
query so that would be possible?
 
Top