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!

Reports filtering problem 1

Status
Not open for further replies.

jpl458

Technical User
Sep 30, 2009
337
US
I have a form that is open (fmCust_Hist) and I want to print a report of the data in that form. I have created a print button on the form that prints a report (CustHistReport). The control source for the report is a query (Cust_History). I want to filter the data for that report with the data that is in Account_Number which is a text box on the form. In the filter field on the report form I have the following:

[Account_Number]='forms!fmCust_History.Account_Number'.

However, the report displays the entire file, and is not constrained. Obviously I am doing something wrong.

The [Account_Number] is the field in the report, and fmCust_History.Account_Number contains the value I want to filter on.

Hope I have this clear enough.

Thanks

jpl

 
try
[Account_Number]=forms!fmCust_History.Account_Number
not
[Account_Number]='forms!fmCust_History.Account_Number'

 
I would expect to see code like:
Code:
Dim strReport as String
Dim strWhere as String
strReport = "CustHistReport"
If not IsNull(Me.Account_Number) Then
  strWhere = "Account_Number = """ & Me.Account_Number & """"
End If
DoCmd.OpenReport strReport, acPreview, , strWhere


Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top