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

Report Where condition in variable doesn't do anything

Status
Not open for further replies.

freyni

Programmer
Mar 20, 2003
3
GB
In my code, I build a where condition to be used in
conjunction with docmd.openreport and I assign it to a
variable vReportCondition.
vReportCondition = "[Sample_Stream] = 'AQU'"

When I run the following:
Docmd.OpenReport vReportName,
acViewPreview,,vReportCondition
the variable vReportCondition has no effect.

When I run:
Docmd.OpenReport vReportName,
acViewPreview,,"[Sample_Stream] = 'AQU'"
the report returns the right results

What am I doing wrong?
 
Put this line:
Code:
  MsgBox vReportCondition
in front of this line (from the first version):
Code:
  acViewPreview,,vReportCondition
If that doesn't provide a clue, how is vReportCondition defined? It should be Dim'd as a string.

 
Thanks for the help. I checked the datatype and it is a string. I've used the debug window to monitor the value of the variable. I've even pasted the result into my code to replace the variable - and it works. It just doesn't work with the variable
 
freyni,

I can't see anything obviously wrong and I can't reproduce this in Access 97. There must be something more you're not telling us!

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top