Help with Filter Syntax Please

  • Thread starter Thread starter Chaster
  • Start date Start date
C

Chaster

Could someone tell me what I am doing wrong. I would think this would work
but I am getting a syntax error and it pulls up what I think is a paramater
box with the value that I just selected from my cboSelectShow

Private Sub cboSelectShow_AfterUpdate()
Me.Filter = ("[Showname]= " & Me.cboSelectShow)
'Debug returns value Me.Filter = "[Showname]= Links, Inc." (This was the
name of the show I selected to test with)
Me.FilterOn = True
End Sub
 
Could someone tell me what I am doing wrong. I would think this would work
but I am getting a syntax error and it pulls up what I think is a paramater
box with the value that I just selected from my cboSelectShow

Since the field you're searching is of Text type, you must enclose the
value being searched in quotemarks - either ' or ". Since a show name
may well contain an apostrophe, e.g. 'Sophie's Choice', which would
prematurely end the string, use " instead. Its ASCII code is 34:

Me.Filter = ("[Showname]= " & Chr(34) & Me.cboSelectShow & Chr(34))

This will set the filter property to

[Showname] = "Links, Inc."
 
Back
Top