Results 1 to 6 of 6

Thread: Dased and Confused!!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    UK
    Posts
    4

    Question

    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!!!

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    UK
    Posts
    4
    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.


  4. #4
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621
    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


  5. #5
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    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

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    UK
    Posts
    4
    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
  •  



Click Here to Expand Forum to Full Width