You can resolve this problem in the following ways:
- Mark all fields as allowing nulls.
-or-
- Make sure that you explicitly insert values into every non-null field.
You can use the following VBA code within Access to add a record:
NOTE: The sample code in this article uses Microsoft Data Access Objects. For this code to run properly, you must reference the Microsoft DAO 3.6 Object Library. To do so, click
References on the
Tools menu in the Visual Basic Editor, and make sure that the
Microsoft DAO 3.6 Object Library check box is selected.
Sub Test_VFP_ODBC_Driver()
Dim wks As DAO.Workspace
Dim foo As DAO.Connection
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set wks = DBEngine.CreateWorkspace("", "Admin", "", dbUseODBC)
wks.DefaultCursorDriver = dbUseODBCCursor
Set foo = wks.OpenConnection("", dbDriverNoPrompt, False, "ODBC;dsn=MyNameDSN;NULL=NO")
Set rs = foo.OpenRecordset("MyOrders", dbOpenDynaset, 0, dbOptimistic)
rs.MoveFirst
Do Until rs.EOF
rs.Edit
rs.Fields(0) = "150"
rs.Update
rs.MoveNext
Loop
End Sub