Running Specific Reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to find out if I can press a button in a form and have a input
box pop-up where I can enter in a name ie. company name and run a report on
that company. Does anyone have code or even know if this is possible or does
the users just have to create a query everytime? Thanks in advance.
 
Use the Where condition in the OpenReport Command line, to pass the criteria
to filter on the company name
========================================
The code for the button click event

Dim MyWhereCondition as String
MyWhereCondition = "[Company Name Field name in the table] = '" &
Me.[Company Name Field in the form] & "'"
Docmd.OpenReport "ReportName",,, MyWhereCondition
=========================================
The single quote is for string filter

If you filter on a number it will be
MyWhereCondition = "[Company Name Field name in the table] = " & Me.[Company
Name Field in the form]
 
Try this
Select company
from company
Where company = [:conpany name];

The colon : is what makes it work. This is the function for a parameter
Have a good day
Karamursel
 
Back
Top