Autonumfix again

M

Maarkr

I thought if I ran it once it would fix everything...but it reverted to an
earlier autonum on a new record... any ideas or should I just call the proc
when I open the form every time? I'm looking at MS KB 884185 and am curious
if you see something in this routine that may be causing the autonum error
(pasted from VB window):

'insert records into training table
strSQL = "INSERT INTO TrainingTbl(CourseID,MbrID,TngDate)
VALUES(" & lngClassID & "," & lngMbr & ",#" & dtClassDate & "#);"
'Debug.Print strSQL
dbs.Execute strSQL, dbFailOnError

'delete duplicate training for member and course
strSQL = "DELETE TrainingTbl.AT_ID, TrainingTbl.CourseID,
TrainingTbl.MbrID, TrainingTbl.TngDate" & _
" FROM TrainingTbl " & _
" WHERE (((TrainingTbl.AT_ID)<>(SELECT Max(AT_ID) AS MaxOfAT_ID
FROM TrainingTbl As Dupe WHERE Dupe.CourseID=TrainingTbl.CourseID AND
Dupe.MbrID = TrainingTbl.MbrID)));"
'Debug.Print strSQL

DoCmd.SetWarnings (0)
DoCmd.RunSQL strSQL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top