databasems-access-2013ms-access-2016vba7msdasql

ODBC--Call failed on RecordSet


Hellow i need your help i have a access database software, so i decided to migrate into sql server by sql migration assistant after that i tested my linked tabled to my access Graphical user, but fails some of code it seems doesn't applied in that are linked in sql server my code is

Dim Activity As Recordset

Set Activity = CurrentDb.OpenRecordset("UserActivity")
        
        Activity.AddNew
        
        Activity!ActivityType = "Login To Afya DB"
        Activity!RefDocument = Me.Name
        Activity!Description = "User Has Seen Home_Page"
        Activity!UserName = Me.txtUserName.Value
        Activity!ActionedOn = Format(Now(), "dd/mm/yyyy")
         
Activity.Update

I have tryed to add dbSeeChanges

Set Activity = CurrentDb.OpenRecordset("UserActivity", dbOpenDynaset, dbSeeChanges)
        
        Activity.AddNew
        
        Activity!ActivityType = "Login To Afya DB"
        Activity!RefDocument = Me.Name
        Activity!Description = "User Has Seen Home_Page"
        Activity!UserName = Me.txtUserName.Value
        Activity!ActionedOn = Format(Now(), "dd/mm/yyyy")
         
Activity.Update

But still give this Massage i get wen am starting excuting and When i debug the problem is

Activity.Update

Solution

  • Always pass true date values to a date/time field; Format returns text.

    Also, list the error information if any. So:

    Set Activity = CurrentDb.OpenRecordset("UserActivity", dbOpenDynaset, dbSeeChanges)
            
    Activity.AddNew
          
        Activity!ActivityType = "Login To Afya DB"
        Activity!RefDocument = Me.Name
        Activity!Description = "User Has Seen Home_Page"
        Activity!UserName = Me.txtUserName.Value
        Activity!ActionedOn = Date
             
    Activity.Update
    
    ' Print ODBC error.
    Debug.Print Errors(0)