K
Kevin Coleman
Hi,
I am having a most perplexing problem.
I have moved all of my access tables to SQL Server 2000
and linked them to my access 2000 database.
Reading data is no problem... however when I try to add a
row to a table using code, I get an ODBC-Failed Call
error. After doing some testing, it appears the primary
key field on the form isn't being automatically updated
(it's NULL)... when I manually assign the next number to
the key field, it saves OK.
Here's my code:
Set DB = CurrentDb()
Set rs = DB.OpenRecordset("StudentForms", dbOpenDynaset,
dbSeeChanges)
rs.AddNew
rs![lnkStudent] = pkStudent
rs![lnkProgram] = CStr([Forms]![frmStudents]!
[lstRegisteredPrograms])
rs![Name] = cmbForm
rs.Update
On the rs.Update, the error occurs.
If I go out to the debugger and type:
rs![pkStudentForms]=19010
(for example), and then hit F8 to perform the update
command, it works fine.
Can anyone help me out?
Thanks,
Kevin Coleman
I am having a most perplexing problem.
I have moved all of my access tables to SQL Server 2000
and linked them to my access 2000 database.
Reading data is no problem... however when I try to add a
row to a table using code, I get an ODBC-Failed Call
error. After doing some testing, it appears the primary
key field on the form isn't being automatically updated
(it's NULL)... when I manually assign the next number to
the key field, it saves OK.
Here's my code:
Set DB = CurrentDb()
Set rs = DB.OpenRecordset("StudentForms", dbOpenDynaset,
dbSeeChanges)
rs.AddNew
rs![lnkStudent] = pkStudent
rs![lnkProgram] = CStr([Forms]![frmStudents]!
[lstRegisteredPrograms])
rs![Name] = cmbForm
rs.Update
On the rs.Update, the error occurs.
If I go out to the debugger and type:
rs![pkStudentForms]=19010
(for example), and then hit F8 to perform the update
command, it works fine.
Can anyone help me out?
Thanks,
Kevin Coleman