Click to See Complete Forum and Search --> : Dased and Confused!!!
freddibna
Oct 27th, 2000, 09:37 AM
Q. I am using VB6 and have setup a data environment to a MSAccess database through a system DSN. I can browse through records in the tables using the movenext and moveprevious methods. However, I am having trouble adding new records. I have tried the addnew and the update commands, but they don’t seem to be the correct ones.
I get this error with the addnew command....
Run-time error '3251':
Object or provider is not capable of performing
requested operation.
Answers on a post card please…. First correct entry out of the hat wins a pint!!!
kovan
Oct 27th, 2000, 10:36 AM
looks like your using ado..
and looks like your using default lock and cursor types
instead of
RS.open SQLstring, conn
try RS.Open SQLString, conn, 3, 3 'numbers are constants for different locking
if that doesnt help
post your code
freddibna
Oct 27th, 2000, 10:44 AM
I am a complete beginner and as such am more or less making things up as I go along.
I used the following to move forward and backwards through records
code:
Private Sub Command1_Click()
DataEnvironment1.rspersonal.MovePrevious
DataEnvironment1.rsbenefits.MovePrevious
DataEnvironment1.rsaddress.MovePrevious
DataEnvironment1.rsbank.MovePrevious
End Sub
I assumed that using this would allow me to add new records
code:
Private Sub Command1_Click()
DataEnvironment1.rspersonal.addnew
DataEnvironment1.rsbenefits.addnew
DataEnvironment1.rsaddress.addnew
DataEnvironment1.rsbank.addnew
End Sub
Obviously I have to do much more. If you know of where I could find an example of code from start to finish or if you could talk me through it I would be very grateful.
Cheers.
Andrew.
Gary.Lowe
Oct 27th, 2000, 10:53 AM
Andrew
In the properties of your datenvironment there should be somewhere you can change the CursorType to OpenKeyset.
This enables you to write to the database
Hope this is of use
kovan
Oct 27th, 2000, 10:58 AM
fred
post your connection and all other code on the form
and put around it so its readable
thanks
i will do my best to fix the code up for ya
freddibna
Oct 30th, 2000, 03:19 AM
Here is the connection
Private Sub Command1_Click()
DataEnvironment1.rspersonal.MovePrevious
DataEnvironment1.rsbenefits.MovePrevious
DataEnvironment1.rsaddress.MovePrevious
DataEnvironment1.rsbank.MovePrevious
End Sub
Private Sub Command2_Click()
DataEnvironment1.rspersonal.MoveNext
DataEnvironment1.rsbenefits.MoveNext
DataEnvironment1.rsaddress.MoveNext
DataEnvironment1.rsbank.MoveNext
End Sub
Private Sub Command3_Click()
Load Form2
Form2.Show
End Sub
Private Sub Command4_Click()
Load Form3
Form3.Show
End Sub
Private Sub Command5_Click()
Load Form4
Form4.Show
End Sub
Private Sub Command6_Click()
DataEnvironment1.rspersonal.AddNew
DataEnvironment1.rsbenefits.AddNew
DataEnvironment1.rsaddress.AddNew
DataEnvironment1.rsbank.AddNew
End Sub
Private Sub Connection1_InfoMessage(ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pConnection As ADODB.Connection)
End Sub
Private Sub DataEnvironment_Initialize()
End Sub
Private Sub rsaddress_WillChangeField(ByVal cFields As Long, ByVal Fields As Variant, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.