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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Compile error - Syntax error



 
 
Thread Tools Display Modes
  #1  
Old December 31st, 2009, 05:30 PM posted to microsoft.public.access.forms
Walter
external usenet poster
 
Posts: 129
Default Compile error - Syntax error

I'm trying to set up a multiselect listbox for a query parameter. I found a
reference to http://www.mvps.org/access/forms/frm0007.htm for code to
accomplish this. However when I copied and pasted this code into my code
window the last line - strSQL=left$(strSQL,len(strSQL)-12)) was highlighted
in red. Debug shows it to be a syntax error. How do I correct this?
--
Thanks for your help!
Walter
  #2  
Old December 31st, 2009, 05:52 PM posted to microsoft.public.access.forms
Daniel Pineault
external usenet poster
 
Posts: 658
Default Compile error - Syntax error

Correct me if I'm wrong, but do you not have 1 too many brackets??? Should
it not be:

strSQL = Left$(strSQL, Len(strSQL) - 12)
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"Walter" wrote:

I'm trying to set up a multiselect listbox for a query parameter. I found a
reference to http://www.mvps.org/access/forms/frm0007.htm for code to
accomplish this. However when I copied and pasted this code into my code
window the last line - strSQL=left$(strSQL,len(strSQL)-12)) was highlighted
in red. Debug shows it to be a syntax error. How do I correct this?
--
Thanks for your help!
Walter

  #3  
Old December 31st, 2009, 06:08 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Compile error - Syntax error

On Thu, 31 Dec 2009 09:30:01 -0800, Walter
wrote:

I'm trying to set up a multiselect listbox for a query parameter. I found a
reference to http://www.mvps.org/access/forms/frm0007.htm for code to
accomplish this. However when I copied and pasted this code into my code
window the last line - strSQL=left$(strSQL,len(strSQL)-12)) was highlighted
in red. Debug shows it to be a syntax error. How do I correct this?


This appears to be the very common References bug. Open any
module in design view, or open the VBA editor by typing
Ctrl-G. Select Tools... References from the menu. One of the
..DLL files required by Access will probably be marked
MISSING. Uncheck it, recheck it, close and open Access.

If none are MISSING, check any reference; close and open
Access; then uncheck it again. This will force Access to
relink the libraries.
--

John W. Vinson [MVP]
  #4  
Old December 31st, 2009, 06:20 PM posted to microsoft.public.access.forms
Walter
external usenet poster
 
Posts: 129
Default Compile error - Syntax error

I got it worked out - extra parenthesis on the end.
--
Thanks for your help!
Walter


"Walter" wrote:

I'm trying to set up a multiselect listbox for a query parameter. I found a
reference to http://www.mvps.org/access/forms/frm0007.htm for code to
accomplish this. However when I copied and pasted this code into my code
window the last line - strSQL=left$(strSQL,len(strSQL)-12)) was highlighted
in red. Debug shows it to be a syntax error. How do I correct this?
--
Thanks for your help!
Walter

 




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 05:16 AM.


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