Access 2000 and VB6 gives me 3426 error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michelle

    Access 2000 and VB6 gives me 3426 error

    Hi. I am trying to add new records to an Access 2000 database using VB6.
    But I keep getting this 3426 "action cancelled by object" error. I've
    updated DAO to 3.6 and checked MSDN. Their code doesn't do anything. Here's
    my code. How do I connect to Access 2000 properly and add records without
    getting that 3426 error. Thanks in advance.

    Dim dbs As Database
    Dim rs As DAO.Recordset
    Set dbs = DBEngine(0).Ope nDatabase(dFile Name)
    Set rs = dbs.OpenRecords et("PCA")
    Set Data1.Recordset = rs
    CustomerID.Text = CustomerId(1000 )
    Data1.Recordset .AddNew
    Data1.UpdateRec ord

  • Bruce Pick

    #2
    Re: Access 2000 and VB6 gives me 3426 error

    I believe I had a similar error condition when tapping into Access databases
    via asp.net web pages (we used very similarly coded connections to the
    database).

    My solution: open the database connection only long enough to update the
    record, then close the database connection from the outside application.

    If you leave the connection open, Access locks the database to a
    considerable degree to protect it's own data integrity, and you can't get at
    the data again until you close the connection. Sometimes closed by shutting
    down the outside application, sometimes by shutting down the pc or server
    holding the database.

    Bruce Pick

    "Michelle" <Cutey@4.you> wrote in message
    news:Xns94708D5 5A1DA1Oro4you@1 29.250.170.88.. .[color=blue]
    > Hi. I am trying to add new records to an Access 2000 database using VB6.
    > But I keep getting this 3426 "action cancelled by object" error. I've
    > updated DAO to 3.6 and checked MSDN. Their code doesn't do anything.[/color]
    Here's[color=blue]
    > my code. How do I connect to Access 2000 properly and add records without
    > getting that 3426 error. Thanks in advance.
    >
    > Dim dbs As Database
    > Dim rs As DAO.Recordset
    > Set dbs = DBEngine(0).Ope nDatabase(dFile Name)
    > Set rs = dbs.OpenRecords et("PCA")
    > Set Data1.Recordset = rs
    > CustomerID.Text = CustomerId(1000 )
    > Data1.Recordset .AddNew
    > Data1.UpdateRec ord
    >[/color]


    Comment

    Working...