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

  • Thread starter Thread starter John
  • Start date Start date
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
 
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
 
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
.
.
 
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!
 
Back
Top