Prev: Amending figures in a Table in Access
Next: Please help to give outer join instead of inner join
From: blake7 on 19 May 2010 07:48 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 19 May 2010 08:51 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 19 May 2010 09:00 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 19 May 2010 10:04 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 19 May 2010 10:15 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 >
|
Pages: 1 Prev: Amending figures in a Table in Access Next: Please help to give outer join instead of inner join |