MS Access question

archcommus

Diamond Member
Sep 14, 2003
8,115
0
76
I have many queries in a database that all pull criteria from a variety of forms. Many of the queries are identical except for being used in conjunction with different forms. So far I've been copying and pasting these queries, renaming them something different, and then changing the appropriate criteria fields to match the right form. Is there any way to avoid this, to just have one query that can pull data from different forms? I was considering a subform that say would let you pick a member and date range, and then that subform could be used in many other forms and the queries could reference the subform, but I don't think this works.

Any ideas? Thanks.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
I have used a temp table to prep data that is used by a query.

Query is fixed to pull data from the temp table field.

Forms update the temp table as needed then activate the query.
 

archcommus

Diamond Member
Sep 14, 2003
8,115
0
76
Can you explain the syntax for this? It doesn't seem I can just do Tables!TableName!Field like I can do Forms!FormName!TextBox.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Concept:

From the form you extract data and store it into a table (ex: labeled Temp_For_Query).
Within the tables are fields for each piece of data.

The "Master" query selects the data from each field that it needs to act as parameters
 

archcommus

Diamond Member
Sep 14, 2003
8,115
0
76
Thanks, I understand the concept, but how are you implementing this "master" query? I suppose directly in the Criteria line I could put: ALike (SELECT Member FROM Temp_For_Query), but that would make it take a massive amount of time since it'd be doing an extra query for every single record.

Should I make the master query a saved query, and then "include" it like a table in every query that needs it? The only way it seems that would work is if I then did joins WITH the master query, but then I'm not even really using parameters or the Criteria line anymore, plus that wouldn't work with things like Between.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
I do not play with Access forms therefore can not help you any futher in this regard.

However, the query into the Temp should become stored in cache and therefore not "executed" as second time unless the data changes.

Good Luck
 

archcommus

Diamond Member
Sep 14, 2003
8,115
0
76
Thanks for your help. I understand your idea, and don't even really need any form assistance. I'm just still confused about where this master query should go and how the main query should use its results as criteria. I figured this part you could explain since you said you had done this before, but that's okay.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Think of it as joining two tables together.

I was using the method described to allow a client to dynamically create customized reports
 

archcommus

Diamond Member
Sep 14, 2003
8,115
0
76
Ahh....that's what I thought you might've been doing. Good idea, but that won't work for things like Between statements, since nothing "equals" anything else, it just has to be between two values. In that case it seems the only way to do it would be to put a select statement in the between statement, for example Between (SELECT StartDate FROM Temp_For_Query) AND (SELECT EndDate FROM Temp_For_Query), but that makes the main query take a very long time to complete.

Oh well, we tried. I've taken enough of your time today, thanks for the help!
 

snapper316

Member
Feb 16, 2006
58
0
0
How about making a global date range form and have command buttons show up depending on if the criteria form is loaded?


i.e. every form you have now w/ startdate and endDate take those boxes off, add a command button that only says "reports" this will open the new global date range form.......depending on what forms are loaded (IsLoaded property) command buttons are visible/invisible

each command button would open the proper report for that form



Or another option

Put your criteria on the Main Form and have all the other forms that use those criteria as subforms in a tab control
 

archcommus

Diamond Member
Sep 14, 2003
8,115
0
76
Thanks for the suggestions. Both would work, however I ended up going with a slightly different approach to avoid any significant changes to my already existing forms. I left all my forms unchanged, except for when you click the button to run the report, it first copies all the values over to another form that is hidden, and all queries are set to grab their parameters from this form. Works very well.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |