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.
Ofer - 11 Oct 2005 20:38 GMT
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]

Signature
I hope that helped
Good luck
> 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.
Karamursel - 11 Oct 2005 22:26 GMT
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
> 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.