Locking Recordsets - dbOptimistic vs. dbPessimistic

Locking Recordsets - dbOptimistic vs. dbPessimistic

Post by Mathieu M. Berub » Sat, 29 Jan 2000 04:00:00



I have a data control on a form and it was working fine until I realized
that if two people are using the program then no changes are allowed to the
data.  I've tried setting the data control as:

Set data.recordset = dbdata.openRecordset("t_table",dbopendynaset, ,
dbOptimistic)

but it gives me an error (3001) saying that it's not right parameter.

How do I let two (or more) people have access to edit the same table at the
same time.  not necessarely the same record but at least the same table?

Please Help.

Mat

 
 
 

Locking Recordsets - dbOptimistic vs. dbPessimistic

Post by Steve Jorgense » Sat, 29 Jan 2000 04:00:00


Access does not normally lock an entire table unless you tell it to, but it
does lock pages, not records.  One page may contain many records, so
pessemistic locking certainly can affect another user working on a different
record, but will not always do so.  That being said, optimistic locking
(which you are trying to use) is still almost always preferable to
pessemistic locking.

As for your error message, I'm afraid I can't see why it's occurring.  Your
syntax appears correct, and I run similar statements frequently.  Have you
checked to see if you have any broken references?


>I have a data control on a form and it was working fine until I realized
>that if two people are using the program then no changes are allowed to the
>data.  I've tried setting the data control as:

>Set data.recordset = dbdata.openRecordset("t_table",dbopendynaset, ,
>dbOptimistic)

>but it gives me an error (3001) saying that it's not right parameter.

>How do I let two (or more) people have access to edit the same table at the
>same time.  not necessarely the same record but at least the same table?

>Please Help.

>Mat


 
 
 

Locking Recordsets - dbOptimistic vs. dbPessimistic

Post by Glenn Miyashi » Sat, 29 Jan 2000 04:00:00


I may be wrong but was under the impression that only Pessimistic Locking is
available using Data Controls. In any event, you can try to clear the LockEdits flag
after the Dynaset is created as in:
Data1.RecordSet.Lockedits = True  ' Pessismistic Locking, Default in DAO
Data1.RecordSet.Lockedits = False  ' Optimistic Locking


Quote:>I have a data control on a form and it was working fine until I realized
>that if two people are using the program then no changes are allowed to the
>data.  I've tried setting the data control as:

>Set data.recordset = dbdata.openRecordset("t_table",dbopendynaset, ,
>dbOptimistic)

>but it gives me an error (3001) saying that it's not right parameter.

>How do I let two (or more) people have access to edit the same table at the
>same time.  not necessarely the same record but at least the same table?

>Please Help.

>Mat

VB IRC for Intermediate to Advanced Users.
   Undernet   #vb-advanced
 
 
 

Locking Recordsets - dbOptimistic vs. dbPessimistic

Post by Per Larse » Sun, 30 Jan 2000 04:00:00


Have you checked the Form's 'Record Locks' property?

HTH    PerL



Quote:> I have a data control on a form and it was working fine until I realized
> that if two people are using the program then no changes are allowed to
the
> data.  I've tried setting the data control as:

> Set data.recordset = dbdata.openRecordset("t_table",dbopendynaset, ,
> dbOptimistic)

> but it gives me an error (3001) saying that it's not right parameter.

> How do I let two (or more) people have access to edit the same table at
the
> same time.  not necessarely the same record but at least the same table?

> Please Help.

> Mat