L
LarryJ
Ok, I have what I think is going to be next to impossible, but I
thought I'd see what the brains around here might be able to come up
with. Bare with me as I lay the ground work, then get to the question.
I have an Access 2003 form which will show the user all the queries in
the database (that don't start with "qry") which are queries they like
to view ("Yearly Cost Export") and export to Excel. All they have to do
is double-click the query and they can see the results, without having
to bother me or get into the database window. When they need a new one,
I create it and that's it, they can access it.
Now, some of the queries have date ranges, so I wrote functions
GetFromDate and GetToDate to get those dates via a msgbox (which I
hate).
I have another nice form to let the user use a calendar control to set
the From/To date, but I need to figure out a way to show that form
before the query executes, if they choose one of those types of
queries.
SO I added some code to the Double-Click event which will check the
queries SQL looking for the "GetFromDate" function in the query. If
it's there, I then show the form before I open the query and it's
working nicely.
Here's where the problem comes in though. One of the queries they can
double-click is based on another query that uses the GetFromDate
function. The problem though, is that the SQL of the underlying query
the top level query is based on, is not exposed when I look at the
QueryDefs SQL.
Now, I guess I could run through the entire SQL string and look for
other queries, but some of these queries are very complicated and may
be based on many queries, so I'm hoping not to have to go that way.
Mainly because finding the query names in the sql statement, could be
very time consuming.
Do I have any other options?
Thanks,
Larry
thought I'd see what the brains around here might be able to come up
with. Bare with me as I lay the ground work, then get to the question.
I have an Access 2003 form which will show the user all the queries in
the database (that don't start with "qry") which are queries they like
to view ("Yearly Cost Export") and export to Excel. All they have to do
is double-click the query and they can see the results, without having
to bother me or get into the database window. When they need a new one,
I create it and that's it, they can access it.
Now, some of the queries have date ranges, so I wrote functions
GetFromDate and GetToDate to get those dates via a msgbox (which I
hate).
I have another nice form to let the user use a calendar control to set
the From/To date, but I need to figure out a way to show that form
before the query executes, if they choose one of those types of
queries.
SO I added some code to the Double-Click event which will check the
queries SQL looking for the "GetFromDate" function in the query. If
it's there, I then show the form before I open the query and it's
working nicely.
Here's where the problem comes in though. One of the queries they can
double-click is based on another query that uses the GetFromDate
function. The problem though, is that the SQL of the underlying query
the top level query is based on, is not exposed when I look at the
QueryDefs SQL.
Now, I guess I could run through the entire SQL string and look for
other queries, but some of these queries are very complicated and may
be based on many queries, so I'm hoping not to have to go that way.
Mainly because finding the query names in the sql statement, could be
very time consuming.
Do I have any other options?
Thanks,
Larry