Hi, I am trying to just simply create and open a query. But for some reason, it won't work, and gives me an error message saying:
Run-time error '91': Object variable or With block variable not set
Below is a bit of the code, and where the error occurs.
Dim objConn As New ADODB.Connection
Dim FindHOBq As String
objConn.Open strConnect
FindHOBq = "SELECT MIN(HOB), AVG(HOB), MAX(HOB) FROM [Ballistic Tests] WHERE ID = 76 GROUP BY [Group]"
FindHOBrs.Open FindHOBq, objConn, adOpenDynamic, adLockReadOnly <---- error occurs here
FindHOBrs.MoveFirst
Does anyone have a clue why this won't open the query? The other queries I have in this report open just fine, but for some reason this one won't.
Thanks, Tim
Run-time error '91': Object variable or With block variable not set
Below is a bit of the code, and where the error occurs.
Dim objConn As New ADODB.Connection
Dim FindHOBq As String
objConn.Open strConnect
FindHOBq = "SELECT MIN(HOB), AVG(HOB), MAX(HOB) FROM [Ballistic Tests] WHERE ID = 76 GROUP BY [Group]"
FindHOBrs.Open FindHOBq, objConn, adOpenDynamic, adLockReadOnly <---- error occurs here
FindHOBrs.MoveFirst
Does anyone have a clue why this won't open the query? The other queries I have in this report open just fine, but for some reason this one won't.
Thanks, Tim