From: blake7 on
Hi all, can anyone spot the syntax error in the code below, its driving me
mad !!
Thanks


Private Sub FilterUIN_Click()
If Me![FilterUINText].Value = "" Then
Me.SERDatasheet.Form.FilterOn = False
Else
Me.SERDatasheet.Form.Filter = "boiler uin like'*" &
Me![FilterUINText].Value & "*' or Desc like '*" & Me![FilterUINText].Value &
"*'"
Me.SERDatasheet.Form.FilterOn = True
End If


End Sub
From: Douglas J. Steele on
There's a space in your field name. Change to

"[boiler uin] like'*"

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"blake7" <blake7(a)discussions.microsoft.com> wrote in message
news:E00D14AD-02E6-4AB9-AF3F-7A4B3C11A5FA(a)microsoft.com...
> Hi all, can anyone spot the syntax error in the code below, its driving me
> mad !!
> Thanks
>
>
> Private Sub FilterUIN_Click()
> If Me![FilterUINText].Value = "" Then
> Me.SERDatasheet.Form.FilterOn = False
> Else
> Me.SERDatasheet.Form.Filter = "boiler uin like'*" &
> Me![FilterUINText].Value & "*' or Desc like '*" & Me![FilterUINText].Value
> &
> "*'"
> Me.SERDatasheet.Form.FilterOn = True
> End If
>
>
> End Sub


From: Daryl S on
Blake7 -

I suspect "boiler uin" is the name of a field since it is before 'like'. If
so, it needs square brackets due to the space in the fieldname. Try this:

Private Sub FilterUIN_Click()
If Me![FilterUINText].Value = "" Then
Me.SERDatasheet.Form.FilterOn = False
Else
Me.SERDatasheet.Form.Filter = "[boiler uin] like'*" &
Me![FilterUINText].Value & "*' or Desc like '*" & Me![FilterUINText].Value &
"*'"
Me.SERDatasheet.Form.FilterOn = True
End If

--
Daryl S


"blake7" wrote:

> Hi all, can anyone spot the syntax error in the code below, its driving me
> mad !!
> Thanks
>
>
> Private Sub FilterUIN_Click()
> If Me![FilterUINText].Value = "" Then
> Me.SERDatasheet.Form.FilterOn = False
> Else
> Me.SERDatasheet.Form.Filter = "boiler uin like'*" &
> Me![FilterUINText].Value & "*' or Desc like '*" & Me![FilterUINText].Value &
> "*'"
> Me.SERDatasheet.Form.FilterOn = True
> End If
>
>
> End Sub
From: blake7 on
Thanks Guys, should have spotted that, brain freeze!!
Regards

"Douglas J. Steele" wrote:

> There's a space in your field name. Change to
>
> "[boiler uin] like'*"
>
> --
> Doug Steele, Microsoft Access MVP
> http://www.AccessMVP.com/DJSteele
> (no e-mails, please!)
>
> "blake7" <blake7(a)discussions.microsoft.com> wrote in message
> news:E00D14AD-02E6-4AB9-AF3F-7A4B3C11A5FA(a)microsoft.com...
> > Hi all, can anyone spot the syntax error in the code below, its driving me
> > mad !!
> > Thanks
> >
> >
> > Private Sub FilterUIN_Click()
> > If Me![FilterUINText].Value = "" Then
> > Me.SERDatasheet.Form.FilterOn = False
> > Else
> > Me.SERDatasheet.Form.Filter = "boiler uin like'*" &
> > Me![FilterUINText].Value & "*' or Desc like '*" & Me![FilterUINText].Value
> > &
> > "*'"
> > Me.SERDatasheet.Form.FilterOn = True
> > End If
> >
> >
> > End Sub
>
>
> .
>
From: John Spencer on
Also missing space between Like and quote marks

Private Sub FilterUIN_Click()
If Me![FilterUINText].Value = "" Then
Me.SERDatasheet.Form.FilterOn = False
Else
Me.SERDatasheet.Form.Filter = "[boiler uin] like '*" &
Me![FilterUINText].Value & "*' or Desc like '*" & Me![FilterUINText].Value &
"*'"
Me.SERDatasheet.Form.FilterOn = True
End If

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Daryl S wrote:
> Blake7 -
>
> I suspect "boiler uin" is the name of a field since it is before 'like'. If
> so, it needs square brackets due to the space in the fieldname. Try this:
>
> Private Sub FilterUIN_Click()
> If Me![FilterUINText].Value = "" Then
> Me.SERDatasheet.Form.FilterOn = False
> Else
> Me.SERDatasheet.Form.Filter = "[boiler uin] like'*" &
> Me![FilterUINText].Value & "*' or Desc like '*" & Me![FilterUINText].Value &
> "*'"
> Me.SERDatasheet.Form.FilterOn = True
> End If
>