12-14-14, 23:36 #1Registered User
- Join Date
- May 2012
Unanswered: Can we make this criteria in a query?
We make a criteria in a query to get data from from1 like: [forms]![form1]![text1]. This requires us to have the Form1 open and there should be a data in Text1.
Can we make the criteria to either take the data from Form1 like the above, or if Form1 is not open it gets data for the criteria from another form like : [forms]![form2]![text2].,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
I asked god to please give me everything to enjoy the life, God said: i gave you the life to enjoy everything.
12-15-14, 03:52 #2Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
into one query referring to different forms, No
into one query for use in another form or report, yes
you coudl pass the criteria as the new form/reports opening arguments, assumignmyou are doing so using the docm d.openform or openreport
or write the same query to the querydefs collection and use that query as your row source in the other form or report
or 'pull' the required parameters fromt he new form/report. wrpa you code with error trtappign in case target form isn't open.
if it were me then my choice would be
1) assuming you only needed the one new form/report using the query I'd pass the values as part of the openform/openreport macro
2) if you needed the same parameters in several forms/reports, and/or needed those parameters pulled at a later date (when you may have closed the form then save a query to the querydefs collection. BUT be aware in a multi users application that unless you use a split database (separate, but linked fornt & back end, and MOST importantly an indiviudal copy of the front end for each user there is a risk /likelihood that a users may overwrite another users query definition
3) Id use the push/pull method using a form to store the current parameter settings. this is the technique I normally use for reporting suites. the user sets the report suite settings, each form / report form then on uses those settings. this can be a pig to properly set up, and I wouldn't recommend using this approach unless you were confident in developing and debugging in VBAI'd rather be riding on the Tiger 800 or the Norton