AutoNumbers and Insert

Results 1 to 3 of 3

Thread: AutoNumbers and Insert

  1. #1
    Paul Bedford Guest

    Default AutoNumbers and Insert

    I am trying to insert 2 pieces of data from a form into an access database. <BR><BR>The database has four fields the first of which is an Autonumber, <BR>the next two being text fields that I would like to insert into, and the last being a Yes/No data type.<BR><BR>The thing is everytime I try to insert into the two fields - I get an error telling me that I have duplicate records even if the table is empty......?<BR><BR>Am I being stupid or is this a problem?<BR><BR>Any help ASAP appreciated<BR><BR>Paul

  2. #2
    Paul Bedford Guest

    Default RE: AutoNumbers and Insert: This is the code

    &#060;% Set db = server.createObject("ADODB.connection") db.open "be095419" srtSQL = "Insert into StudentsandModules (ModuleId, StudentID) VALUES "&_ "(&#039" & request.querystring("ModuleID") & "&#039, &#039" & request.querystring("Custid") & "&#039)" db.execute strSQL &#037;&#062;

  3. #3
    jhomminga@cmaiglobal.com Guest

    Default RE: AutoNumbers and Insert: This is the code

    Check the index validation for those non key fields to allow duplicates.<BR><BR>Maybe you are not setting values and two nulls are two equivalant values in the same field as move from record to record.<BR><BR>If you are not acting directly on the autonumber field then the SQL statement will cause the record to EDIT/SAVE.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •