Connecting Tech Pros Worldwide Forums | Help | Site Map

Access 2000 and VB6 gives me 3426 error

Michelle
Guest
 
Posts: n/a
#1: Nov 12 '05
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).OpenDatabase(dFileName)
Set rs = dbs.OpenRecordset("PCA")
Set Data1.Recordset = rs
CustomerID.Text = CustomerId(1000)
Data1.Recordset.AddNew
Data1.UpdateRecord


Bruce Pick
Guest
 
Posts: n/a
#2: Nov 12 '05

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:Xns94708D55A1DA1Oro4you@129.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).OpenDatabase(dFileName)
> Set rs = dbs.OpenRecordset("PCA")
> Set Data1.Recordset = rs
> CustomerID.Text = CustomerId(1000)
> Data1.Recordset.AddNew
> Data1.UpdateRecord
>[/color]


Closed Thread