Pass a parameter to a report with Click event?

  • Thread starter Thread starter Jim Evans
  • Start date Start date
J

Jim Evans

How can this be done? I want to pass the CustomerID to a report when calling
the report from a button click event.

Any help is greatly appreciated.

tia,

Jim Evans
 
Jim said:
How can this be done? I want to pass the CustomerID to a report when calling
the report from a button click event.


Why?

If all you want is to filter the report to a specific
customer, then it can be specified in the OpenReport's
WhereCondition argument:

stCriteria = "[CustomerID] = " & Me.txtCustomerID
DoCmd.OpenReport stDocName, , , stCriteria

This way the report has no need to know that there's
anything special about the CustomerID field.
 
Marsh,

Thanks, perfect solution. I was trying to make it much more complex than
needed be.

Again, Thanks.

Jim Evans

Marshall Barton said:
Jim said:
How can this be done? I want to pass the CustomerID to a report when calling
the report from a button click event.


Why?

If all you want is to filter the report to a specific
customer, then it can be specified in the OpenReport's
WhereCondition argument:

stCriteria = "[CustomerID] = " & Me.txtCustomerID
DoCmd.OpenReport stDocName, , , stCriteria

This way the report has no need to know that there's
anything special about the CustomerID field.
 
Back
Top