Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need drop down boxes to specify report search criteria

Status
Not open for further replies.

gottalottacharge

Technical User
May 1, 2001
1
US
I am new at Access 97. I need to write a report that allows you to search the database by specifying from a drop down box exactly what you want to specify. For example, if I want to search for a particular item, I select it from the drop down box. Then, I want to specify the area the item is located in (city or town, etc) and when I press the search button, it would display my report based on the search criteria I entered.
 
Normally you would use something like this

Dim strItem as String, strLocation as String
strItem = Me.ComboName
strLocation = Me.LocationTextbox
DoCmd.OpenReport "ReportName",acViewPreview,,"[Item] = ' " & strItem " ' And [Location] = ' " & strLocation & " ' "

That would be the normal syntax for filtering a report. I've put spaces between the single quotes ' and the double quotes " for readability. You should not have spaces when you write your code.

Paul
 
Hi,
There is an alternative technique to doing it in SQL. I have written an FAQ on the subject.
faq703-2696 HTH,
Randy Smith
California Teachers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top