I
iconicchris
Hi everyone -
I'm trying to use a where clause to open a report for preview - but it
only works when hard-coded - if I introduce a variable that looks
exactly the same as the hard-code, the where clause is ignored. Any
ideas what I'm doing wrong - or is this an Access issue? I'm using
Access 2003... Code follows:
Hard-coded:
DoCmd.OpenReport "RTS_SetReport", acViewPreview, , "[locationID]=3"
variable:
Dim stLinkCriteria As String
Dim location As String
location = lsdDDL.Column(0) 'retrieves a value from a combo box
stLinkCriteria = "[locationID]=" & location 'for this, stLinkCriteria
is "[locationID]=3"
DoCmd.OpenReport "RTS_SetReport", acViewPreview, , location
Thanks,
Chris
I'm trying to use a where clause to open a report for preview - but it
only works when hard-coded - if I introduce a variable that looks
exactly the same as the hard-code, the where clause is ignored. Any
ideas what I'm doing wrong - or is this an Access issue? I'm using
Access 2003... Code follows:
Hard-coded:
DoCmd.OpenReport "RTS_SetReport", acViewPreview, , "[locationID]=3"
variable:
Dim stLinkCriteria As String
Dim location As String
location = lsdDDL.Column(0) 'retrieves a value from a combo box
stLinkCriteria = "[locationID]=" & location 'for this, stLinkCriteria
is "[locationID]=3"
DoCmd.OpenReport "RTS_SetReport", acViewPreview, , location
Thanks,
Chris