If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Probelms with Optional Recordset Argument

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-24-04, 16:12
Viggy Viggy is offline
Registered User
 
Join Date: Jan 2004
Posts: 18
Probelms with Optional Recordset Argument

I have two methods, one for opening a ADOConnections, one for closing.
Here i'll call them OpenADO() and closeADO().

Both have Byref ADO Connection as ADODB.COnnection, and ByRef ADOCommand as ADODB.COmmand in their arguments.
Also, both have byref OPTIONAL recordset as ADODB.RECordset, since i won't always be needing to open and close recordsets when i'm running my SQL commands.

The OpenADO runs fine, whether or not i include the recordset in the argument.

Close ADO has a line of code 'RecordSet.Close', which of course works fine if i include the argument. If I do not include the optional argument, the line returns an error 'object not set'. I figured maybe the code isn't recognizing the optional argument correctly, so i changed it to:
'If Not IsMissing(RecordSet) Then RecordSet.Close'. This once again runs fine if the argument is included, BUT i'm still getting the same error when I leave out the record set argument. Anyone have any clue why? I have looked all over, and found no reason why this shouldn't work, or even why the line of code is being read when the conditional is not met?

Thanks,
Viggy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On