Solved

Inset into statement

Posted on 2013-11-05
5
230 Views
Last Modified: 2013-11-11
Please help me, having an issue with this bit of code. it keeps telling me missing operator in query expression. been trying to learn access on my own but this has me stumped. thank you


  With Me!lbSelected
                For Each varItem In .ItemsSelected
                 Select Case .Column(0, varItem)
                        Case Is <> " "
                         
                         QSRJ1 = QSRJ1 & "'" & .Column(0, varItem) & "',"
                         
                         strBle = "Select distinct [BlendMix].[BlendMix] " _
                         & "from [BlendMix],[BlendFix] " _
                         & "Where [BlendFix].[FPC-ID NUMBER] " & QSRJ1
                         
                         
                    '     DoCmd.RunSQL "Delete from BledSor"
                         strBlendSor = "Insert into BlendSor ([ID])" & strBle
                         DoCmd.RunSQL strBlendSor
                         
                    End Select
                    strList = strList & "'" & .Column(0, varItem) & "',"
                 
               Next varItem
            End With
0
Comment
Question by:Denthion
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
ID: 39625189
Your problem appears o be with the following as there is no operator in the where clause :

& "Where [BlendFix].[FPC-ID NUMBER] " & QSRJ1

Should it be :

& "Where [BlendFix].[FPC-ID NUMBER] =" & QSRJ1
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39625200
change this line

strBlendSor = "Insert into BlendSor ([ID])" & strBle

with

strBlendSor = "Insert into BlendSor ([ID]) Values(" & strBle & ")"
0
 
LVL 84
ID: 39625211
Also, if FPC-ID Number is a Text field:

& "Where [BlendFix].[FPC-ID NUMBER] ='" & QSRJ1 & "'"

Also, there's no space between the (ID) and your subquery, and you might also need to enclose the subquery in parentheses in Access:

 strBlendSor = "Insert into BlendSor ([ID]) (" & strBle & ")"
0
 

Author Comment

by:Denthion
ID: 39625224
thank you all for your amazingly fast responses. I got it working thanks to Jacko72 I was missing an operator clause
0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 39627743
It helps to put in a Debug.Print statement to display a variable such as QSRJ1 in the Immediate Window, so you can quickly debug any problems with missing operators, etc.  Or you can add a Watch for it.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question