Query with one form and present results in another form

K

krempin

I'm working on the finishing touches of my Access project and want the user
to be able to search the database with the use of a simple single field form
and than have the results presented in another more detailed form with many
more fields with all the details. Right now, I only have the later, more
detailed form and I have to have the user click "filter by form" button to
get it to work.

So my question is, how do I create a simple single field form with a button
to search that will return with a more detailed form with all the fields
filled in based on the single field query?
 
S

Steve Schapel

Krempin,

Make an unbound form, with an unbound textbox or combobox, as
appropriate, and a command button. Then make a query, and in the
Criteria of the field in question, refer to the search form control
using syntax such as...
[Forms]![NameOfForm]![NameOfControl]
Then, base your second form on this query. Make a macro or VBA
procedure on the Click event of the command button to open the main data
form.

An alternative approach is to not put the form reference in the query,
and instead refer to it in the Where Condition argument of the OpenForm
action in your macro, where you would put something like...
[NameOfField]=[Forms]![NameOfForm]![NameOfControl]
 

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