Access Cursors - Which do I use?

Plumby

New Member
Joined
Jul 13, 2004
Messages
1
Hi All
I'm an old hand with VBA in Excel, but Access is new to me. I've been writing a program that has an Excel Form (and code), but reads/writes all it's data to Access. Since there are about 120 users of this form, I've had problems with the database getting 'locked' and other users getting errors. It seems there's a hundred way to open a recordset...

DB_SQL = "SELECT * FROM MyTable"
1) .Open DB_SQL, DB_Conn, adOpenDynamic, adLockBatchOptimistic
2) .Open DB_SQL, DB_Conn, adOpenKeyset, adLockPessimistic
3) .Open DB_SQL, DB_Conn, adOpenKeyset, adLockBatchOptimistic
4) .Open DB_SQL, DB_Conn, adOpenDynamic, adLockOptimistic
5) .Open DB_SQL, DB_Conn, adOpenStatic, adlockReadOnly
6) .Open DB_SQL, DB_Conn, adOpenDynamic, adLockPessimistic
7) ...and many more...

Can someone please tell me which is the best way to open a cursor for these situations:
Adding a new record - With .AddNew, adding 1 record at a time (I use method 1 above)
Updating a record with a small change quickly (I use method 4)
Updating hundreds of records at once, the connection has to remain open for about 10 minutes? (this is when other users start getting errors, it seems the whole table is locked, I use method 6)

Can anyone help me with past experiences? How can I make my updates and not lock anyone else out? Thanks.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,221,777
Messages
6,161,871
Members
451,727
Latest member
tyedye4

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top