Search Form

F

Fie

Hi,

Iam currently trying to develope a search form (frmSearch) that a user
types a value into a text box and it then searches the table
(tblCounrty) and the results are displayed in a list box. I have
attached the query to the list box but I have totally forgot the code
to put behind the search button and also behind the listbox so when
the correct entry in the list box is double clicked the results are
opened up on a results form (frmResults).

can someone help me

Fiona
 
K

Klatuu

I guess I only answered half the question. The code I posted previously goes
in the Click event of the search button.

In the Double Click event of the form, use the value selected in the list
box to open your form to the selected record:

strSearch = Me.MyListBox
Docmd.Openform "frmSearch", , ,"SomeField = " & strSearch

The above syntax assumes SomeField is numeric. If it is text:
Docmd.Openform "frmSearch", , ,"SomeField = '" & strSearch & "'"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top