Okay so that won't work. Will it work if instead of clicking to call
reports call a form for entering the dates and then calling reports. I would
have to create another form. Will that work? Will the same syntax apply?
Thank you.
:
It depends on what kind of form your subform is. If it is a single view form,
yes, for a datasheet or continuous form, no.
--
Dave Hargis, Microsoft Access MVP
:
Alrighteeeee then, I have no choice but to use text boxes. Do these text
boxes have to be on the main form or can they be on the subform where the pt
is listed?
:
No. When you select preview, it runs the report which causes the prompt.
Then when you print it, it actually runs the report again which causes the
second prompt. Your choices are live with the multiple prompts or use the
text boxes.
--
Dave Hargis, Microsoft Access MVP
:
Okay I have opted not to have the textboxes in my main form. Instead have
report prompt for each pt. I was also able to narrow the date paramenters
into only one date for each set of dates. However, when the report opens it
prompts me for dates which is fine. But when I sent to print it prompts me
again. Is there a way to eliminate the second prompt? Thank you.
:
If there are multiple subreports that need the dates, then each will have to
prompt for the dates. I know of no other way to do this for multiple sub
reports.
If only one subreport needs dates, then you can cause it to prompt for the
dates like this:
SELECT Feild1, Field2, Field3 FROM MyTable WHERE Field3 Between
[Enter StartDate] AND [Enter EndDate];
When the query runs, it will pop up an input box with Enter Start Date and
another for EndDate, but since each subreport has it's own query, each query
will have to get the date. If you use the dates on the form as I suggested,
there will be no prompts.
--
Dave Hargis, Microsoft Access MVP
:
Is there another way to do this without having to put text boxes on my form?
My main form has a subform. Main form consists of doctor info. Subform
lists pts assoc with doc. When I call the main report from main form it
generates the sub reports of pt info. There can be 1 to 6 different
subreports assoc with any one doc. There can be several instances of one
particular sub report that need start and end dates specific to the pts. ex:
Rpt 1, Rpt 2, Rpt 3 - Rpt 2 could be called twice with 2 different pts.
Need report to prompt twice. So is there any other way to do this? Thank
you - your help is very much appreciated as I am not proficient in Access or
code.
:
I meant the record source of the subreport.
Put text boxes on your form to enter the dates and reference the text boxes
in the query
SELECT Feild1, Field2, Field3 FROM MyTable WHERE Field3 Between
Forms!MyForm!txtStartDate AND Forms!MyForm!txtEndDate;
Note I corrected my syntax from the previous post.
--
Dave Hargis, Microsoft Access MVP
:
I do have a query for the recordsource of my report which pull all types of
this report. However, These dates that I enter are not dates that I need to
store in my database. They are needed only when calling report in order to
print report with these dates. So where would I put the info you provided?
Thank you
:
In that case, you can have a query for the recordsource of the subreport that
filters based on the values of the text fields on the report:
SELECT Feild1, Field2, Field3 FROM MyTable WHERE Field3 Between
Forms!MForm!txtStartDate AND txtEndDate;
--
Dave Hargis, Microsoft Access MVP
:
Thank you for responding. I am sorry for not being more specific.
This is my situation. I have one main report and several sub reports. This
particular sub report is the one with dates that need to be entered before
printing. Therefore, on my report depending on specific provider when I
click on command button it calls the main report within the main report there
are different subreports. It is in one of the subreports where I need to
promt for dates? How do I do this. Can you provide sample? Thank you again.
:
You should not have to have any prompts. If you run the report from a form,
add controls for each of the dates. Then use the Where argument of the
OpenReport method to filter the records based on the dates. The Where
argument is just like an SQL Where clause. Take the filtering out of your
query.
--
Dave Hargis, Microsoft Access MVP
:
I have a report that promts 3 times asking for dates like: Enter "Start
Date" to "End Date" for different types of dates. Therefore in all it will
prompt the user 6 times. I would like to narrow the prompts to at least 3 if
possible by somehow just prompting once for each instance and getting the
Start Date to End Date in one prompt. How do I do this? Can someone please
help with this. Thank you in advance for any help.