B
bob
Hi
I am having trouble with a query based recordset which I
am trying to open after a click event on a form in Acess
2000. The query uses info from the form controls. Code
snippet is below:
dim mdb as database
dim qd as querydef
dim rst as recordset
set mdb=currentdb()
set qd=mdb.QueryDefs("qry1")
set rst=qd.openrecordset
qry1 is a stored query in the db, it has no parameters
but uses form controls in criteria fields. The strange
thing is if I have the form open and controls
selected/established, then click the button to run the
code above, after the set rst statement above, the
rst=Nothing, but if I open the query in design view, then
click view (with the form open and controls
selected/established), it shows records ! Don't recall
seeing this before. In the code I can see the form
control values which make up criteria for the query. I
cannot figure out why the query works from design view
but not from code?
Only thing I can say is the query is based on 2 tables
and the tables do not have an inherent relationship
established, but in the query design view grid, 1 is
established between two fields.
I tried to simplify the query criteria w/ no luck. Not
sure I need to though since I can see the intended
records outside of the code.
Help !
Bob
I am having trouble with a query based recordset which I
am trying to open after a click event on a form in Acess
2000. The query uses info from the form controls. Code
snippet is below:
dim mdb as database
dim qd as querydef
dim rst as recordset
set mdb=currentdb()
set qd=mdb.QueryDefs("qry1")
set rst=qd.openrecordset
qry1 is a stored query in the db, it has no parameters
but uses form controls in criteria fields. The strange
thing is if I have the form open and controls
selected/established, then click the button to run the
code above, after the set rst statement above, the
rst=Nothing, but if I open the query in design view, then
click view (with the form open and controls
selected/established), it shows records ! Don't recall
seeing this before. In the code I can see the form
control values which make up criteria for the query. I
cannot figure out why the query works from design view
but not from code?
Only thing I can say is the query is based on 2 tables
and the tables do not have an inherent relationship
established, but in the query design view grid, 1 is
established between two fields.
I tried to simplify the query criteria w/ no luck. Not
sure I need to though since I can see the intended
records outside of the code.
Help !
Bob