Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sql code problem

Posted on 2016-10-09
6
Medium Priority
?
39 Views
Last Modified: 2016-10-09
Can some one see what I am doing wrong here? I get variable not defined on ChangeCheck. Probably missed a dammed commer somewhere

        strSQL = _
            "INSERT INTO Sets (ItemNumber, DoorNumber, Batch, Location, ChangeCheck) " & _
            "SELECT " & lngNewID & " AS ItemNumber, DoorNumber, Batch, Location, ChangeCheck " & _
            "FROM Sets " & _
            "WHERE (ItemNumber=" & lngOldID And ((ChangeCheck) = -1)
        CurrentDb.Execute strSQL, dbFailOnError
0
Comment
Question by:DatabaseDek
[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
  • 4
  • 2
6 Comments
 
LVL 51

Accepted Solution

by:
Gustav Brock earned 2000 total points
ID: 41835817
I get variable not defined on ChangeCheck.

Then ChangeCheck either not exists or is misspelled.

And/or correct this as:

    "WHERE (ItemNumber=" & lngOldID & " And ChangeCheck = -1)

/gustav
0
 

Author Closing Comment

by:DatabaseDek
ID: 41835820
Thank you
0
 

Author Comment

by:DatabaseDek
ID: 41835822
Gustav are you on the list of people that can contract for projects? I have a simple one that need help
0
10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

 
LVL 51

Expert Comment

by:Gustav Brock
ID: 41835823
Yes, feel free: gustav[@]cactus.dk
0
 

Author Comment

by:DatabaseDek
ID: 41835846
Hi Gustav

I believe it has to go through EE How do I find you?
0
 

Author Comment

by:DatabaseDek
ID: 41835853
Hi Gustav

Here is the Link to project

Normally I would suggest reading the posts but I would not if I were you. The problem as Pat Hartman says is simple. each expert commenting has made it more and more difficult. If you just leave a message I will post you a simple question

https://www.experts-exchange.com/gigs/2507/Solving-a-query-problem.html
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

670 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