?
Solved

How to detect then existence of an object (a recordset actually)

Posted on 2003-02-20
4
Medium Priority
?
180 Views
Last Modified: 2010-05-01
Hi there,

  I would like to create a new recordset (RS) upon changes of a particular value (say Val). But before this, there might be another old RS created. So, before I can recreate RS, I need to detect the existence of any open RS, destroy it and create a new one with different values (but using the same object name which is "RS").
  How should I detect the existence of RS? Or perhaps there is any other better option to solve this problem.
  Thank you!


:O)
0
Comment
Question by:allicia
4 Comments
 
LVL 55

Expert Comment

by:Ryan Chong
ID: 7991328
if not rs is nothing then
   'Exist
else
   'No Exist
end if
0
 

Author Comment

by:allicia
ID: 7991555
I tried this, but every "RS Is Nothing" returns False.

RS is actually a global constant. It is called with OpenRS() function whenever it's needed and closed with CloseRS() function.

0
 
LVL 9

Accepted Solution

by:
Naveen Swamy earned 300 total points
ID: 7991881
hi,
if If rs.State = adStateOpen Then rs.Close

hope this will solve ur purpose

Rgds,
Navstar16
0
 
LVL 4

Expert Comment

by:eozz_2000
ID: 7991889
If you want to lose the old RS then:

...
set RS = nothing
...

then, you can use the RS without problems.
0

Featured Post

Technology Partners: 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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

579 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