dbOpenDynaset, dbOpenDynamic....Opening recordsets:

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi,I have seen this term in List Methods...
When do we use each of them, and what does it mean.:)
Rather, how do i know what to use when....

dbOpenDynaset
dbOpenDynamic
dbOpenForwardOnly
dbOpenSnapshot
dbOpenTable
dbOpenOptimistic

Thanks in advance for helping.


 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
dbOpenDynaset pretty much always works. I use that most always. You can use dbOpenTable if you know you are really opening a table (CurrentDB.OpenRecordset "Table1", dbOpenTable)

A dynaset type recordset allows movement back and forth in the recordset. A forward-only type recordset only lets you move forward (hence, the name). A table type recordset is presumably optimized for recordsets that are bound to tables.

This is DAO, not ADO - so don't get confused on that point (most of your posts this week have been about ADO). There's a lot of information in the Access help files but it takes a little while to get used to how its organized.

More info on DAO recordsets:
http://allenbrowne.com/ser-29.html
 
Upvote 0
Thanks a alot Xen...

from the below example;
is Resume Exit_MyProc same as Goto Exit_MyProc?
Everything was cool...just want to clarify this? and so the author also says that dbOpenDynaset type works for everything like table, query etc....so i can always use dbOpenDynaset in all my quotes right?:)

Thanks again for helping!



Code:
[/FONT]
[FONT=Courier New]Sub MyProc
    On Error Goto Err_MyProc
        Dim db as Database
        Dim rst As Recordset

        Set db = CurrentDb()
        Set rst = db.OpenRecordset("MyTable")
        'Useful code here.
        rst.Close            'Close what you opened.

    Exit_MyProc:
        Set rst = Nothing    'Deassign all objects.
        Set db = Nothing
        Exit Sub

    Err_MyProc:
        'Error handler here.
        Resume Exit_MyProc
    End Sub
 
Upvote 0
so i can always use dbOpenDynaset in all my quotes right
Yes, I use dynaset type recordsets most of the time. I use table type recordsets when I really am opening a table. Forward only recordsets are supposed to be faster when you are only moving forward through the records (i.e., first to last in order). But I think you'd have to have a very many number of records in order to ever notice any difference.

is Resume Exit_MyProc same as Goto Exit_MyProc?
Yes and no. It will go to Exit_MyProc. But since it's an error handling instruction, it will also "reset" the error handling which is what you want when leave your error handling block.
 
Upvote 0

Forum statistics

Threads
1,213,501
Messages
6,114,010
Members
448,543
Latest member
MartinLarkin

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