Search button help

  • Thread starter Thread starter SempaiDan
  • Start date Start date
S

SempaiDan

Guest
I need some help with a simple function in access.

I am trying to create an application whose purpose is to maintain a database of customer names and addresses. This is contained in a table called tblCustomers.

I have create a from whose purpose is supposed to be to search within the table by zip code and return them to the user via a report. The form is called frmZipLookup and contains a text box called 'zip' and a button called 'GetReport.' 'zip' is where the user inputs the desired zip code, 'getreport' is the button that is supposed to bring up the search results.

Now, at first I created a report called rptCustomers based on the tblCustomers, and I had the button bring up this report, however I was not sure how to limit the report to only the zip code entered on the form.

I created a query called qryZipLookup. I put tblCustomers in this query and dragged down the * field and the zip code field from the table.

I would like to use a sql statement to make this work, but so far none of the statements I have written have produced any results at all.

How can I create a button which will search within the table by the zip code field?
 
How about ...
On Click event of a button
Code:
Dim strFilterEvents as String
 strFilterEvents = "zipcode = '" & [Zip] & "'"
 DoCmd.OpenReport "MyReport", acViewPreview, , strFilterEvents

it goes like this
you open a report of your choice (MyReport) in preview mode (or put it normal..as you wish) with the filter on your ZipCode field of your form parse to it.
 

Users who are viewing this thread

Back
Top Bottom