?
Solved

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

Posted on 2003-02-20
4
Medium Priority
?
174 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 53

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

801 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