Display Search Results in Form

E

edmiller

Hi everyone,

Help is greatly appreciated.

I am using Access 97 (a bit behind I know, all we could afford :S)

So I have a table (tblVendors) with 5 fields : Vendor ID, Vendor Name, Vendor
Address, Vendor AB, Vendor FDL.

I have a form (frmVendor) with two Text Boxes: Vendor_ID and Vendor_Name and
one Command Button: (cmdSearch).

The purpose of the form is for the User to input either the Vendor ID or the
Vendor Name, click the Command Button (cmdSearch) and get the proper results.

So I've used the QBF Technique. What I've done is on the "On Click" property
of the Command Button (cmdSearch) run a Macro (SearchMacro) that the only
thing it does is "Open a Query" that I've named qrySearch.
In this Query (qrySearch) I've put the 5 fields of my initial table and below
the Vendor ID and Vendor Name fields I've put: Forms!frmVendor!Vendor_ID and
Forms!frmVendor!Vendor_Name respectively.
So when the User types the Name of the Vendor or the Vendor ID on the form
and clicks the Command Button the search results are perfectly displayed in a
separate Datasheet view Window.

So what I need to do is to display the results in the same Search Form. I'd
like for the User to input the data, click the search button, and below in
the same form display the results (not in a Datasheet view). How can I
acomplish this?? What should I add to my form?

Thank you in advance to all!!
 
A

Allen Browne

Ed, download the free sample database in this article:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

It shows how to build a filter string from whichever box(es) the user typed
their criteria into, and then apply that as the Filter of the form.
Consequently, the results show up in the form where the user entered their
criteria.

If you have never worked with VBA, it will take a bit of effort to follow
what's going on, but it's worth it. You will use this filtering technique on
lots of forms and also for reports.
 

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