Carl Provost
November 13th, 1999, 06:07 PM
I'm having a problem with something very simple. I'm using an Access 2000 database, with a Visual Basic 6.0 front end. I'm opening the connection like this:
Dim cnData as ADODB.Connection
Dim rsCustomers as ADODB.Recordset
... then in the Form Load Event
set cnData = new ADODB.Connection
cnData.Provider = "Microsoft.Jet.OLEDB.4.0"
cnData.ConnectionString = "Data Source= <path to the db>"
cnData.Open
set rsCustomers = new ADODB.Recordset
rsCustomers.Source = "SELECT * FROM Customers"
rsCustomers.ActiveConnection = cnData
rsCustomers.CursorType = adOpenKeyset
rsCustomers.CursorLocation = adUseClient
rsCustomers.LockType = adLockOptimistic
rsCustomers.Open
' At this point everything is fine. The user enters the data into the text boxes
'and presses the save button, which calls the following code...
The error occurs on the line after .AddNew
The Error number is -2147217887
The Error Message "Errors Occured"
When I trapped the error description in a message box, I found out the the
Err.Source is the Microsoft Cursor Engine.
private Sub SaveData()
With rsCustomers
.AddNew
!FName = txtFName 'it fails on this line
!LName = txtLName
!MI = txtMI
!Address = txtAddress
!City = txtCity
!State = txtState
!Zip = txtZip
!Phone = txtPhone
.Update
End With
End Sub
This is driving me crazy! I hope someone can help
Carl
Dim cnData as ADODB.Connection
Dim rsCustomers as ADODB.Recordset
... then in the Form Load Event
set cnData = new ADODB.Connection
cnData.Provider = "Microsoft.Jet.OLEDB.4.0"
cnData.ConnectionString = "Data Source= <path to the db>"
cnData.Open
set rsCustomers = new ADODB.Recordset
rsCustomers.Source = "SELECT * FROM Customers"
rsCustomers.ActiveConnection = cnData
rsCustomers.CursorType = adOpenKeyset
rsCustomers.CursorLocation = adUseClient
rsCustomers.LockType = adLockOptimistic
rsCustomers.Open
' At this point everything is fine. The user enters the data into the text boxes
'and presses the save button, which calls the following code...
The error occurs on the line after .AddNew
The Error number is -2147217887
The Error Message "Errors Occured"
When I trapped the error description in a message box, I found out the the
Err.Source is the Microsoft Cursor Engine.
private Sub SaveData()
With rsCustomers
.AddNew
!FName = txtFName 'it fails on this line
!LName = txtLName
!MI = txtMI
!Address = txtAddress
!City = txtCity
!State = txtState
!Zip = txtZip
!Phone = txtPhone
.Update
End With
End Sub
This is driving me crazy! I hope someone can help
Carl