|
-
Jan 7th, 2005, 02:57 AM
#1
Thread Starter
Lively Member
How to check if a recordset is opened ?
I have declare a recordset
VB Code:
public rs as new ADODB.recordset
It is used in many functions that I have in my form.
However sometimes, I encounter problem when I try to open it again as it says it is already opened. Reason because I allow the user to break the loop and exit function hence, sometimes the recordset is not closed.
Question : How can I check if a particular recordset is already opened ?
If I can check if it is opened then I can do a rs.close which will solve my problem.
Anyone with solution please help !!!
Last edited by icongroup2003; Jan 7th, 2005 at 03:43 AM.
-
Jan 7th, 2005, 03:00 AM
#2
Re: How to check if a recordset is opened ?
When the loop is exited close the recordset.
-
Jan 7th, 2005, 03:07 AM
#3
Thread Starter
Lively Member
Re: How to check if a recordset is opened ?
My function is complex .... I know that by exiting the loop I can close it, however, when the user break the loop .... it can sometimes bypass the recordset.close
Again, once the recordset is closed, it cannot be close again. A error will be prompted.
Also, is there a way to turn off error messages in VB6 ?
Sometime like in access where you can docmd.setwarnings = false ...
but in VB6 you cannot ....
-
Jan 7th, 2005, 03:17 AM
#4
Thread Starter
Lively Member
Re: How to check if a recordset is opened ?
Ok problem solved.
Apparaently, there is a property .state which allow me to check if it is opened or not.
VB Code:
if rs.state = adStateOpen then rs.close
That solved my problem.
Cheers !!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|