Solved

Openrecordset parameters

Posted on 1998-04-23
2
223 Views
Last Modified: 2012-05-04
hi, there
I like to know some details example about how to use the openrecordset(parameters). In what conditions I should use dbopendynaset, table, snapshot, and forwardonly, readonly, etc.
I have read the VB help file. but I want to know some real world examples.
Could anyone give me some hints?

ny971181
0
Comment
Question by:ny971181
2 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 30 total points
ID: 1428026
First of all, the dynaset, table, and snapshots.

Snapshots are for read-only recordsets.  They are quicker to load so if you don't need to edit the data, use this.

Dynasets are editable recordsets.  If you need to edit the data use this.

Tables are somewhat like dynasets, but are more limited in the methods to use (such as searching for a particular value).  It is preferred to use dynasets instead of this.

Forward only, allows for a faster loading of the recordset.  Snapshots are always opened as forward only.  If you don't need to move back and forth through the recordset, use this.

Set rsTable = dbData.OpenRecordset(sTable, dbOpenForwardOnly)
is the same as
Set rsTable = dbData.OpenRecordset(sTable, dbOpenDynaset, dbForwardOnly)

Readonly - If you open a dynaset as read-only, you are in effect opening a snapshot.

Now for examples:

To open a recordset for general uses:
  Set rsTable = dbData.OpenRecordset(sTable, dbOpenDynaset)
This will allow moving though the recordset forward and backward.  It will also allow for adding data and editing existing data.

To open a recordset for reading only, to display a list of available data, for example:
  Set rsTable = dbData.OpenRecordset(sTable, dbOpenSnapshot)
You would use this for something like loading a listbox with data, or creating a report.

If you will do nothing bu add new data to a recordset:
  Set rsTable = dbData.OpenRecordset(sTable, dbOpenDynaset, dbForwardOnly)
This will allow for adding data, but won't allow to seek an existing value.

There are many variations of the options available for OpenRecordset.  This is but a small sampling.
Might I suggest you look into one of the many books available for VB with emphesis on database programming?
0
 
LVL 1

Author Comment

by:ny971181
ID: 1428027
hi, Thank you for your detailed explanation.
That helps a lot.
I did look at some books b4, but none summarize the topic. So I lost them easily.

But thank you again.

ny971181

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question