Form's control data source

Sharoon

New member
Local time
Today, 13:53
Joined
Nov 30, 2003
Messages
8
I had made a form without any data control source
this form contains
some text boxes (not linked to any filed )
and
a text box (for search)
When the user opens the form it doesn't display any data .

what I need in my form:
I need to diplay the records that meet the search criteria to the other text boes(other than the search text box)

In other words the form displays data only when the user search for a specific key word and there are records meet the search criteria. Then the user can see these records in the other text boxes (other than the search text box) and also nivgate through them.

any body can help me how to do that.
 
My approach to this is:

1) Design a main form containing your search text box(s)
2) Create a query based on your table that uses the search box(s) as criteria e.g. LIKE Forms![MainFormName]![TextBoxName].Text
3) Design a sub form with the query being the recordsource. This form will show all the records matching the criteria in the main form.
4) Close the sub form, open the main form in design, then drag the sub form onto it (from the list of forms in the database window)
5) Add an After Update event to each of your search boxes to requery the matching records when the search criteria are updated. The code is Forms!MainFormName!SubFormName.Requery

Notes

In 2) if you initially want all the records displayed, add Forms![MainFormName]![TextBoxName].Text IS NULL as a criteria line

Using LIKE, allows you to use a search using ? and * wildcards

In 1) you can use a combo box that brings up all the unique values in a field of a table

I hope this gets you started

Richard
 

Users who are viewing this thread

Back
Top Bottom