Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Recordset Problem - object is closed

Hey everyone,
I have used two different methods for creating a
recordset for this project and can't figure out why I
keep getting this error when trying to access the
recordcount or fields.count: '3704' Operation is not
allowed when the object is closed.

I TRIED THE OPEN METHOD:
'Create Recordset SLFCT1
Dim rstSLFCT1 As New Recordset
Set rstSLFCT1.ActiveConnection = conSQLSERVERConnection
rstSLFCT1.Open strSQL1, , adOpenStatic, adLockReadOnly,
adCmdText
rstSLFCT1.CursorLocation = adUseClient

'Determine Record Count
IntSLFCT1RowNum = rstSLFCT1.RecordCount

MsgBox "Record Count is " & IntSLFCT1RowNum


AND I TRIED THE CONNECTION OBJECT:
'Create RecordsetSLFCT1
Dim rstSLFCT1 As New Recordset

rstSLFCT1.CursorType = adOpenStatic
rstSLFCT1.LockType = adLockReadOnly
rstSLFCT1.CursorLocation = adUseClient
Set rstSLFCT1 = conSQLSERVERConnection.Execute(strSQL1)

'Determine Record Count
IntSLFCT1RowNum = rstSLFCT1.RecordCount

MsgBox "Record Count is " & IntSLFCT1RowNum


Both are returning this error. It says that the object
is closed? This same exact code as the second method has
has worked for me on a prior report, but with the error
saying object closed I tried the Open method with to no
avail.

The only thing different is that my strSQL1 string which
holds my query, holds a much more sophisticated query
with declared variables and IF BEGIN Blocks and such???

I can't figure this out, please advise

DBAL.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
linking problem with closed documents RCppe Excel Worksheet Functions 0 April 15th 05 06:21 PM
Type recordset/recordset? FlaviusFlav[_9_] Excel Programming 4 May 24th 04 12:16 PM
Operation Is Not Allowed When The Object Is Closed Mike Carlson Excel Programming 4 October 29th 03 02:18 AM
Conceptual Problem with DAO/ADO Recordset Eddy[_3_] Excel Programming 0 September 8th 03 07:43 AM


All times are GMT +1. The time now is 04:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"