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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Filter works in Public but not Private Sub

Status
Not open for further replies.

msreed

Programmer
Jul 25, 2003
21
US
I created a string filter in a private sub and I get an error;
"Can't find the field referred to in your expression"

I have used this same expression in a Public sub and it works fine. What do I need to do differently to get it to work in the Private sub?

strFILTER = [qryrptComprehensiveRevenue_byClient_REDO3]![ClientID] = [Forms]![frmHubReports]![cmbClientNumber]
DoCmd.OpenReport strRPT, acViewPreview, strFILTER
 
I think you problem is something other than private or public sub. You could show us your code.

Rollie E
 
This same code(Select Case OPTCLIENT) works in another area but not here.
I keep playing with how to direct my ClientID and so far nothing works.

Select Case [optOwnerReports]
Case 4
strRPT = "rptComprehensiveRevenueSummary_byClient"
Select Case [optCLIENT]
Case 1 'ALL Clients...
Case 2 'Single Client...
strFILTER = [qryrptComprehensiveRevenue_byClient_REDO3]![ClientID] = [Forms]![frmHubReports]![cmbClientNumber]
Case 3 'Negotiation Clients...
strFILTER = [ARTypeID] = 8
End Select
DoCmd.OpenReport strRPT, acViewPreview, strFILTER
End
 
Is the problem only on case 2? It looks to me like you need a run-time value and you have a compile time value.

strFILTER = "[qryrptComprehensiveRevenue_byClient_REDO3]![ClientID] = '" * [Forms]![frmHubReports]![cmbClientNumber] & "';"


Rollie Easter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top