How to insert data  autoincrement field (MS Access)

Posted on 2005-05-09
Last Modified: 2012-05-05
I will need to insert data to a table where the primary key is autoincremented.

Assuming my PK is CT_ID (autonumber)
The symbol (?) corresponds to CT_ID

What would be the syntax for the following insert:

strInsert = "insert into COURSES_TAKEN (?, UST_ID, COURSE_ID, SEMESTER, [YEAR], GRADE) values ( ?, 1111, 'CRSID', 'SPRING', 2005, 'A')"

Let me know ..

Question by:_Esam
    LVL 33

    Accepted Solution

    ignore the autonumber field
    strInsert = "insert into COURSES_TAKEN (UST_ID, COURSE_ID, SEMESTER, [YEAR], GRADE) values ( 1111, 'CRSID', 'SPRING', 2005, 'A')"

    Author Comment

    Indeed, ignored them, and worked ..


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of convertingā€¦
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    761 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

    8 Experts available now in Live!

    Get 1:1 Help Now