Solved

Inset into statement

Posted on 2013-11-05
5
186 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
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 119

Expert Comment

by:Rey Obrero
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
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: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now