|
-
Oct 27th, 2000, 09:37 AM
#1
Thread Starter
New Member
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!!!
-
Oct 27th, 2000, 10:36 AM
#2
Frenzied Member
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
-
Oct 27th, 2000, 10:44 AM
#3
Thread Starter
New Member
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.
-
Oct 27th, 2000, 10:53 AM
#4
Fanatic Member
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
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Oct 27th, 2000, 10:58 AM
#5
Frenzied Member
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
-
Oct 30th, 2000, 04:19 AM
#6
Thread Starter
New Member
Here is the connection
Code:
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|