Solved

Openrecordset parameters

Posted on 1998-04-23
2
210 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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now