Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object variable or with block variable not set 1

Status
Not open for further replies.

elvenmaiden

Programmer
Apr 25, 2002
31
US
This error occurs in the second with statement.

Went out to Microsoft Knowledge base to retrieve information on creating Group Data Reports dynamically, as far as I can tell I have the right format. But I am getting a object variable or with block variable not set. I am certain there is information in the Access database that will show up in the recordset. Can anyone help? I really grasping at straws. Thanks!

Dim rsUserStats As ADODB.Recordset
Dim cmd As New ADODB.Command

With cmd
.ActiveConnection = conHelpPlus
.CommandType = adCmdText
.CommandText = " SHAPE {SELECT Name, Subject, Questions, Solutions FROM `qryStats`} as Command1 BY 'Name'"
.Execute
End With
With rsUserStats
.ActiveConnection = conHelpPlus
.CursorLocation = adUseClient
.Open cmd
End With
 
You might try changing

Dim rsUserStats As ADODB.Recordset

to

Dim rsUserStats As New ADODB.Recordset

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein


 
Thanks!! 4:00 a.m. really does something to a person's thinking skills.
 
if in vb6 you should set the objects after dim

Set rsUserStats = New ADODB.Recordset
Set cmd = New ADODB.Command

then your code and at the end of proceedure

Set rsUserStats = Nothing
Set cmd = Nothing

this is what i use for ADO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top