A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Syntax Error



 
 
Thread Tools Display Modes
  #1  
Old May 19th, 2010, 12:48 PM posted to microsoft.public.access
blake7
external usenet poster
 
Posts: 153
Default Syntax Error

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
  #2  
Old May 19th, 2010, 01:51 PM posted to microsoft.public.access
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Syntax Error

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" wrote in message
...
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



  #3  
Old May 19th, 2010, 02:00 PM posted to microsoft.public.access
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Syntax Error

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

  #4  
Old May 19th, 2010, 03:04 PM posted to microsoft.public.access
blake7
external usenet poster
 
Posts: 153
Default Syntax Error

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" wrote in message
...
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



.

  #5  
Old May 19th, 2010, 03:15 PM posted to microsoft.public.access
John Spencer
external usenet poster
 
Posts: 7,815
Default Syntax Error

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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:05 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.