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!

set filter based on string

Status
Not open for further replies.

pandapark

Technical User
Jan 29, 2003
92
GB
Hi

I have a form with a listbox whereby the user can select a year, 2004/05 for instance and then open a report based on that choice. the field names for each year are yes/no fields and follow a format of dur_0304, dur_0405 etc
so if the user chooses 2004/05 (the second hidden column in the list box will be dur_0405) I want to say

dim strFilter as string

strFilter = "forms!frmSECTreports!List127.column(1) = true"
' i.e. strFilter = "dur_0405 = true"
DoCmd.OpenReport "rptSECT_current", acViewPreview
Reports!rptSECT_current.Filter = strFilter
Reports!rptSECT_current.FilterOn = True

doesn't like it - I think its something to do with it being a string - any ideas?

thanks
cathy
 
Hi Cathy

Have you tried something like this ...

Code:
strFilter=Forms!frmSECTreports!List127.Column(1) & " = True"

... the combo value is not enclosed in quotes and so the expression is evaluated instead of being read by VBA as a literal string value.

Regards

Mac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top