Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
linking problem with closed documents | Excel Worksheet Functions | |||
Type recordset/recordset? | Excel Programming | |||
Operation Is Not Allowed When The Object Is Closed | Excel Programming | |||
Conceptual Problem with DAO/ADO Recordset | Excel Programming |