[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2638
  • Last Modified:

Run-Time error 3146 ODBC - Call failed

To transfert data to another table I'm using a recordset.
I have an error "Run-Time error 3146 ODBC - Call failed " when my code arrive to update the table ("rsAttendeeLect.Update").
My database is SQL SERVER and my front application is Access 2007.
I can change data from Access table and my other updates on other tables work.

Thanks for your help

If IsNull(Forms!FrmAddAttendeeLecturesOOM!Combo38) Then
 
 MsgBox ("Please select a lecture")
 
Else

Dim LResponse As Integer

LResponse = MsgBox("Do you wish to continue?", vbYesNo, "Continue")

    If LResponse = vbYes Then
   


Set db = CurrentDb
Dim rsAttendee As DAO.Recordset
Dim rqt As String
rqt = "SELECT * FROM dbo_Event_Attendee WHERE a_GoLectureOOM<>" & 0
Set rsAttendee = db.OpenRecordset(rqt, dbOpenDynaset, dbSeeChanges)


Dim rsAttendeeLect As DAO.Recordset
Dim rqt1 As String
rqt1 = "SELECT * FROM dbo_lectures_attendees_OOM"
Set rsAttendeeLect = db.OpenRecordset(rqt1, dbOpenDynaset, dbSeeChanges)

 If rsAttendee.RecordCount <> 0 Then
                       rsAttendee.MoveFirst
                       
                       Do Until rsAttendee.EOF
                        
                         rsAttendeeLect.AddNew
                         
                         rsAttendeeLect!lec_id = Forms!FrmAddAttendeeLecturesOOM!Combo38
                         rsAttendeeLect!Opt_ID = Trim(rsAttendee!Opt_ID)
                         rsAttendeeLect!date_attending = Now
                         'rsAttendeeLect!notes =
                         rsAttendeeLect!att_name = Trim(rsAttendee!A_Name)
                         rsAttendeeLect!att_firstname = Trim(rsAttendee!a_firstname)
                         rsAttendeeLect!att_comp = Trim(rsAttendee!a_company)
                         rsAttendeeLect!att_address = Trim(rsAttendee!a_address)
                         rsAttendeeLect!att_postcode = Trim(rsAttendee!a_postcode)
                         rsAttendeeLect!att_city = Trim(rsAttendee!A_City)
                         rsAttendeeLect!att_province = Trim(rsAttendee!a_province)
                         rsAttendeeLect!att_email = Trim(rsAttendee!a_email)
                         rsAttendeeLect!att_tel = Trim(rsAttendee!A_Tel)
                         rsAttendeeLect!att_lic = Trim(rsAttendee!a_licence)
                         rsAttendeeLect!att_stunum = Trim(rsAttendee!a_student_number)
                         'rsAttendeeLect!att_credits_awarded =
                         rsAttendeeLect.Update
                         
                         
                         rsAttendee.Edit
                         rsAttendee!a_GoLectureOOM = 0
                         rsAttendee.Update
                       
                        
                         rsAttendee.MoveNext
                          
                         Loop
                         
      
                         
     
    End If
    End If
    End If

End Sub

Open in new window

0
SirTKC
Asked:
SirTKC
1 Solution
 
Kelvin SparksCommented:
Check that the SQL Table doesn't have some required fiields that you are not populating (NOT NULL fields)
 
Kelvin
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now