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

OpenReport WhereCondition Issue

Status
Not open for further replies.

rdpress

Technical User
Aug 16, 2002
24
0
1
US
Dim strCriteria as string
Dim strDoc as string
StrDoc =”rptTrainingRoster”
strCriteria = "DateValue([DateofTraining]) = #01/01/2008#"
DoCmd.OpenReport strDoc, acNormal, "", strCriteria

Executing the above lines gives me the following Error Message “This expression is typed incorrectly or is to complex to be evaluate.”

However if I use a string instead of a string variable as sown below, the report opens as you would expect.

DoCmd.OpenReport strDoc, acNormal, "", "DateValue([DateofTraining]) = #01/01/2008#"

Does anyone have a clue as to what is happening? Please help.

Thanks Much!
 
It works for me in a simple set-up. If DateOfTraining is a date, you do not need DateValue. It may be worth testing with a simple report, to check if anything is interfering.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top