Query adjustment (WHERE)

Posted on 2011-04-20
Last Modified: 2012-05-11

This should be a very easy question.

I have an MDB, where I'm running this query in a command button in VBA.

Currentdb.Execute "INSERT INTO tblInput([Field1], [Field2]) SELECT [Field1], [Field2] FROM tblTransfer

Open in new window

Now, I want to change this query to ONLY insert the records 'WHERE  Field2  IS NOT NULL'
How would I do this?
Question by:--TripWire--
    LVL 22

    Accepted Solution

    Currentdb.Execute "INSERT INTO tblInput([Field1], [Field2]) SELECT [Field1], [Field2] FROM tblTransfer WHERE  Field2  IS NOT NULL"
    LVL 1

    Assisted Solution

    You answered it yourself:

    Currentdb.Execute "INSERT INTO tblInput([Field1], [Field2]) SELECT [Field1], [Field2] FROM tblTransfer WHERE Field2 is not null"

    Author Comment

    Wow, how about that?? lol Answered my own question!  Thanks anyways.
    Easiest points you guys ever made!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
    Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
    In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

    779 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

    14 Experts available now in Live!

    Get 1:1 Help Now