Solved

Openrecordset parameters

Posted on 1998-04-23
2
221 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

789 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