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

Syntax error in critera expression

Status
Not open for further replies.

MaggieLeatherman

Programmer
May 9, 2004
59
0
0
US
Hello!
These 2 commands work perfectly by themselves!

DoCmd.OpenReport stDocName, acPreview, , "[BuildingIDFK] = " & Me.txtBuildingID
DoCmd.OpenReport stDocName, acPreview, , "([Percentasbestos] like '*%*' or [Percentasbestos] = 'ACM')"

But I need the criteria together in on OpenReport command. Below I put both the criteria stmts together from above and just separated them with the word 'and'. Now getting
"Type Mismatch" error and the report won't open. Can you help?


DoCmd.OpenReport stDocName, acViewPreview, , "[BuildingIDFK] = " & Me.txtBuildingID And "([Percentasbestos] like '*%*' or [Percentasbestos] = 'ACM')"


Thanks as always for your assistance! Maggie
 
How are ya MaggieLeatherman . . .
. . . abd this:
Code:
[blue]   Dim Criteria As String
   
   Criteria = "[BuildingIDFK] = " & Me.txtBuildingID & " And " & _
              "([Percentasbestos] like '*%*' or [Percentasbestos] = 'ACM')"
   DoCmd.OpenReport stDocName, acViewPreview, , Criteria[/blue]

Calvin.gif
See Ya! . . . . . .
 
Hi AceMan, Thanks for your help, I have so much trouble with syntax in criteria! Maggie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top