Search box to bring up certain record to top of the form

J

John

Can anyone give me some code and how to go about setting
up a textbox that a user could type in a person's last
name or phone number and then after clicking on a button,
the form that has all the records would bring up those
records that matched their search criteria that the user
typed in to the top of the form?

Thanks,
John
 
G

Guest

Dear John
1) Create a new query based on the table containing the
information that you want to extract. Save the Query and
close it.
2) Create a new unbound form (possibly a pop-up?) with the
text box that will be used for your search. Put an OK and
a Cancel button on this form.Save the form.
3) Open the Query you created in step 1 and in the
criteria of the name or tel no. field put Like "*" &
[Forms]![FormName]![TextBoxName] & "*". Once again, save
the query.
4) Create another new form based on the query. Save and
close it.
5) Re-open the form created in step 2 in design view and
in the On-Click event tell it to open the form created in
step 4.

The same result can also be achieved by creating a new
unbound form, putting the text box and the control boxes
in the header area, and then putting a subform based on
the query in the detail area.

Hope this helps

Paul
 
J

John

Thanks for your help. IF I did that those, the record
would not be updateable, correct? Do you know of a way to
do it that will allow the data to be updateable.

Thanks,
John
-----Original Message-----
Dear John
1) Create a new query based on the table containing the
information that you want to extract. Save the Query and
close it.
2) Create a new unbound form (possibly a pop-up?) with the
text box that will be used for your search. Put an OK and
a Cancel button on this form.Save the form.
3) Open the Query you created in step 1 and in the
criteria of the name or tel no. field put Like "*" &
[Forms]![FormName]![TextBoxName] & "*". Once again, save
the query.
4) Create another new form based on the query. Save and
close it.
5) Re-open the form created in step 2 in design view and
in the On-Click event tell it to open the form created in
step 4.

The same result can also be achieved by creating a new
unbound form, putting the text box and the control boxes
in the header area, and then putting a subform based on
the query in the detail area.

Hope this helps

Paul
-----Original Message-----
Can anyone give me some code and how to go about setting
up a textbox that a user could type in a person's last
name or phone number and then after clicking on a button,
the form that has all the records would bring up those
records that matched their search criteria that the user
typed in to the top of the form?

Thanks,
John
.
.
 
J

John Vinson

Thanks for your help. IF I did that those, the record
would not be updateable, correct? Do you know of a way to
do it that will allow the data to be updateable.

A simple SELECT query like this will be updateable. If you're assuming
that queries cannot be updated - correct your assumption!
 

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