Frustration springs eternal 
Author Message
 Frustration springs eternal

I am having trouble with opening a query and recordset in code.  This is
code associated with a form, and I basically am setting values based upon a
query.  The query would be filtered or a parameter query depending on how
you come at it I guess.
the parameter is on the form, called txtClientID.  I have created a
parameter query called qryClienDOPara.  this query has a criterion of
"Forms!frmClientBasic!txtClientID"

The very first line of the below code gives me the following error:

"Object variable or with block not set".   ClientDO has been dimmed as a
query definition.

Set ClientDO = db.QueryDefs("qryClientDOPara")
Set rsClientDO = ClientDO.OpenRecordset(dbOpenSnapshot)



Fri, 04 May 2001 03:00:00 GMT  
 Frustration springs eternal
Have you dimed and set your db variable?
Quote:

>I am having trouble with opening a query and recordset in code.  This is
>code associated with a form, and I basically am setting values based upon a
>query.  The query would be filtered or a parameter query depending on how
>you come at it I guess.
>the parameter is on the form, called txtClientID.  I have created a
>parameter query called qryClienDOPara.  this query has a criterion of
>"Forms!frmClientBasic!txtClientID"

>The very first line of the below code gives me the following error:

>"Object variable or with block not set".   ClientDO has been dimmed as a
>query definition.

>Set ClientDO = db.QueryDefs("qryClientDOPara")
>Set rsClientDO = ClientDO.OpenRecordset(dbOpenSnapshot)



Fri, 04 May 2001 03:00:00 GMT  
 Frustration springs eternal
You could write the query into the code.

such as:

Set dbdata = DBEngine.Workspaces(0).Databases(0)

strSql = "select * from [tbl] where [tblid] = " & somevariable

Set QAData = dbdata.OpenRecordset(strSql)

or:

Set dbdata = DBEngine.Workspaces(0).Databases(0)

Set QAData = dbdata.OpenRecordset(strSql = "select * from [tbl] where
[tblid] = " & somevariable)

Either way should work.

DS

   -**** Posted from Supernews, Discussions Start Here(tm) ****-
http://www.supernews.com/ - Host to the the World's Discussions & Usenet



Tue, 08 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Eternal September Rocks!

2. Looking for a BIOS upgrade for Spring Circle i430FX Triton (2a59cs9b)

3. Spring 2000 Issue of Methods & Tools

4. VB4 Recalled Last Spring?

5. My brain has sprung a leak!?!?!?!

6. My brain has sprung a leak!?!?!?!

7. Relationship Frustration

8. MAX/DMAX Frustration

9. CapsLock Frustration

10. SQL server + IDENTITY + dbSeeChanges + DAO = Frustration

11. VBA frustration (long, code included)

 

 
Powered by phpBB® Forum Software