What went wrong - Please advise!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I used MS Access 2K, ODBC link to SQL2K Server
I got an error code Run-time error 3146. It's highlight at ".Update"

Dim db As Database
Dim Rs1, Rs2, Rs4 As Recordset
Set db = CurrentDb
Set Rs1 = db.OpenRecordset("dbo_case", dbOpenDynaset, dbSeeChanges)
With Rs1
If Not IsNull(Me.lname) And Not IsNull(Me.fname) Then
.AddNew
!Status = 1
.Update
End If
End With
If I put a "s" after Recordset(s) I got an error: Data Method not found.
 
Probably there are fields other than 'Status' which are required, or there
are foreign key or other constraints which prevent the saving of the record.

If you open the table in datasheet view, enter a 1 in the 'Status' field,
and attempt to save the record, you'll likely get a more informative error
message which will indicate what the problem is.
 
In addition to what Brendan said, I'd like to point out that your
declaration isn't doing what you probably think it is.

Dim Rs1, Rs2, Rs4 As Recordset

only declares Rs4 to be a recordset: Rs1 and Rs2 are being declared as
Variants.

Since you're using DAO methods, your declaration should be:

Dim Rs1 As DAO.Recordset, Rs2 As DAO.Recordset, Rs4 As DAO.Recordset
 

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

Similar Threads

What went wrong?Please advise! 9
Access Write array data to access table 0
Update Field 2
Data Type Conversion error 5
ODBC Call Error 2
Run time error in VBA Code 1
On Change Update Subform 1
Too few Parameter. Expected 1 8

Back
Top