Do I have to recreate a recordset everytime I want to use it, or can I
simply create a recordset on the form open event and access it for the
life of the form?
I guess my question is really what is the life of a recordset? 8 1936
It lives as long as the containing object is open/in scope or you close
and destroy the recordset object.
LabGeek wrote: I guess my question is really what is the life of a recordset?
In DAO, until you close it.
You can do what you described for a form. Just dim the recordset
variable at the form level, set it up and openrecordset at the form on
open event and have
rst.close
set rst = nothing
IN the form close event. Don't forget to deal with the database/query
object as well.
I don't have much experience with ADO, but assume the above applies as well.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
LabGeek wrote: Do I have to recreate a recordset everytime I want to use it, or can I simply create a recordset on the form open event and access it for the life of the form?
I guess my question is really what is the life of a recordset?
Generally the same as any any other variable's scope. If you declare a
recordset variable within a function it's scope is that function. If you
declare a global recordset variable (avoid this IMO) then the scope is as
any other global variable.
I think it is preferable to get the recordset when you need it in most
circumstances. Keeping a recordset open can create issues.
ps. declaring a recordset in the form's open event will not work as the
scope is only the open event procudure (ie. when the procedure closes so
does the recordset). Setting a global recordset variable would work but as I
said before I'd avoid that approach if possible.
--
regards,
Br@dley
Until you zap it. DAO recordsets can live on with annoying effects if
they are not explicitly released.
Today, recordsets are rarely needed. Almost all of the recordset code
we see here and in MS documents is inefficient and could be avoided,
(and should have been), with good planning, good design or knowledge of
other ways.
>Today, recordsets are rarely needed. Almost all of the recordset code
we see here and in MS documents is inefficient and could be avoided,
(and should have been), with good planning, good design or knowledge of
other ways.
really? everything i know i learned from taking over maintenance of old
aps - so i guess i picked up bad habits of my predecessors, including
using recordsets to get what i need... planning, design and knowledge
of other ways... [i'm hearing this with a yoda voiceover btw] - where
can i acquire such knowledge?
Who knows?
OTTOMH and on my way out for a geocahing hike:
Read David Epson's and Roy Vidar's posts; avoid almost all the MVPs
except Terry Kreft (how could MS have made a guy so bright an MVP? must
have been a screwup at their end); Study SQL; Convince yourself that
making multiple SQL calls is as efficient as loading a recordset and
modifying data there and safer, cleaner and clearer in what you are
doing; learn some technology (such as ADO) other than DAO which is SO
restricted in its capabilities; read about JET 4 and its new
capabilities which are still ignored here in CDMA after 10? years of
existence; did I mention Study SQL? When you read someone denigrating
newer technologies ask yourself, "Is this just because he/she hasn't
mastered the new technology?" Remember that MS wants to sell its
technology to the unwashed and, perhaps, slants its answers and kb
articles to the level most likely to be accepted and used by the
unwashed.
And remember that I'm 68 and grouchy!
can't someone just plug a cable into the back of my head and upload the
skillset, ala the matrix?
....no you are right... of course. having all the secrets distilled into
one potent pill is a pipe dream *sigh*. big thick books on sql, jet,
odbc, ado, api and OO VB techniques shall be studied. then i'll go into
therapy to help me come to terms it all!
Now, to find a time machine so I can dedicate years to the learning and
return to the same point in time, ala Bill and Ted.
Tim Marshall <TI****@PurplePandaChasers.Moertherium> wrote in
news:e2**********@coranto.ucs.mun.ca: LabGeek wrote:
I guess my question is really what is the life of a recordset?
In DAO, until you close it.
You can do what you described for a form. Just dim the recordset variable at the form level, set it up and openrecordset at the form on open event and have
rst.close set rst = nothing
IN the form close event. Don't forget to deal with the database/query object as well.
I don't have much experience with ADO, but assume the above applies as well.
Well, in regard to scope of variables used to manipulate recordsets,
yes, the same things apply.
But ADO apparently doesn't have the problems with cleanup that DAO
does, so you don't have to manually close and clean up. If I were
using ADO, I'd do it anyway, though, just in case.
--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: gary artim |
last post by:
Hi All,
I have a problem using DBIx::RecordSet. I get correct results but continue
to get these messages on stderr. I looked at Compat.pm and it seems to be
pointing out a problem with my call...
|
by: Tom |
last post by:
I want to open a recordset object on an .asp page. When I open the
recordset I would like to use a stored procedure that expects a parameter to
be passed for the stored procedure. I will then use...
|
by: Adam Short |
last post by:
I am trying to write a routine that will connect a .NET server with a
classic ASP server.
I know the following code doesn't work! The data is being returned as a
dataset, however ASP does not...
|
by: CFW |
last post by:
I thought this was going to be easy but I'm missing something . . . I
need to open an ADODB recordset using the recordset source for a list
box on my for. When my form opens, the list box ADODB...
|
by: lenny |
last post by:
Hi,
I've been trying to use a Sub or Function in VBA to connect to a
database, make a query and return the recordset that results from the
query. The connection to the database and the query...
|
by: kjvt |
last post by:
Based on a prior posting, I've written a function to convert a
recordset to a dataview. The first call to the function for a given
recordset works perfectly, but the second call always returns a...
|
by: ADezii |
last post by:
Most Access Users realize that Recordsets, being virtual representations of a Query, Table, or SQL Statement, exist only in our PC's memory. They, and the data they contain, literally exist at one...
|
by: ADezii |
last post by:
When you create an ADO Recordset, you should have some idea as to what functionality the Recordset does/does not provide. Some critical questions may, and should, be:
Can I add New Records to the...
|
by: Oko |
last post by:
I'm currently developing an MS Access Data Project (.adp) in MS Access
2002.
One of the reports within the DB uses data that is Dynamic and cannot
be stored on the SQL Server. To resolve this, I...
|
by: wallconor |
last post by:
Hi,
I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |