I am trying to insert a row into a table where there exists a unique index on an integer field. I am familiar with access autonumber fields where the db makes it easy and automatically inserts the next number, but how do I do this when using SQL tables. (I am trying to upsize) I continue to get a key violation, which I am sure is because I dont know how to populate the ID field. I am using the following code to do the insert..
*******
'Perform the SQL update for tblLOANMEMO
sql1 = "INSERT INTO dbo_tblLOANMEMO " _
& "(MemoDate, DescCode, UserID, Detail, LoanNumber, StudentID)"
sql2 = "VALUES " & "('" & dteTransDate & "', '" & strCode _
& "', '" & strUser & "', '" & strDetail & "', '" & lngLnNumber _
& "', '" & lngStudentID & "');"
DoCmd.RunSQL sql1 & sql2
******
the field in question is LoanMemoCounter
thanks in advance
ryan paul
*******
'Perform the SQL update for tblLOANMEMO
sql1 = "INSERT INTO dbo_tblLOANMEMO " _
& "(MemoDate, DescCode, UserID, Detail, LoanNumber, StudentID)"
sql2 = "VALUES " & "('" & dteTransDate & "', '" & strCode _
& "', '" & strUser & "', '" & strDetail & "', '" & lngLnNumber _
& "', '" & lngStudentID & "');"
DoCmd.RunSQL sql1 & sql2
******
the field in question is LoanMemoCounter
thanks in advance
ryan paul