BennyLinton
Registered User.
- Local time
- Yesterday, 19:33
- Joined
- Feb 21, 2014
- Messages
- 263
I have a local table "ztblDataChanges" that is working well for the function below, however when i convert this table to a SQL Server table ODBC linked I get the following error... Any ideas?: 
You must use the dbSeeChanges option with OpenRecordSet when accessing a SQL Server table that has an IDENTITY column
	
	
	
		
 You must use the dbSeeChanges option with OpenRecordSet when accessing a SQL Server table that has an IDENTITY column
		Code:
	
	
	Function LogChanges(lngID As Long, Optional strField As String = "")
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim varOld As Variant
    Dim varNew As Variant
    Dim strFormName As String
    Dim strControlName As String
    varOld = Screen.ActiveControl.OldValue
    varNew = Screen.ActiveControl.value
    strFormName = Screen.ActiveForm.Name
    strControlName = Screen.ActiveControl.Name
    Set dbs = CurrentDb()
    Set rst = dbs.TableDefs("ztblDataChanges").OpenRecordset
    With rst
        .AddNew
        !FormName = strFormName
        !ControlName = strControlName
        If strField = "" Then
            !FieldName = strControlName
        Else
            !FieldName = strField
        End If
        !recordid = lngID
        !userName = Environ("username")
        If Not IsNull(varOld) Then
            !OldValue = CStr(varOld)
        End If
        !NewValue = CStr(Nz(varNew, 0))
        .Update
    End With
    'clean up
    rst.close
    Set rst = Nothing
    dbs.close
    Set dbs = Nothing
End Function 
	