One form for multiple reports

  • Thread starter Thread starter Catherine
  • Start date Start date
C

Catherine

Hi, this is my first post and I have not had a lot of
experience with access and haven't worked out codes.

I have a group of 8 reports that I have put together into
one report by making them sub reports. They are based on
different queries but are run for the same period between
two dates. I have a form to enter the dates, with default
values already set. Because it is the criteria for all the
reports I need to press OK 8 times or change the data on
each and press OK.

Is there a way I can enter the data only once for all the
reports? Is collating the reports together as subreports
the best way to do it?

Catherine
 
I am not sure how you have it setup, You say you have a
form with the criterion for your reports.
I assume you are printing or previewing your report with a
report icon on the form wiht the criterion.
You cna most certainly have that one report icon print all
of your reports;
the onclick event should look something like;
Dim DocName As String
Dim LinkCriteria As String
LinkCriteria = "[Report Date] > Forms![YourForm]!
[StartDate]" and "[Report Date] < Forms![YourForm]!
[EndDate]"
stDocName = "YourReport1"
DoCmd.OpenReport stDocName, A_NORMAL, , LinkCriteria
stDocName = "YourReport2"
DoCmd.OpenReport stDocName, A_NORMAL, , LinkCriteria
stDocName = "YourReport3"
DoCmd.OpenReport stDocName, A_NORMAL, , LinkCriteria
etc. for the remaining reports

Hope this helps

Fons
 
Place the selection criteria in the underlying queries, all 8 in this case.

For example, under the field name [Date] in each query enter this criteria,

between form![DateSelect]![startdate] and form![DateSelect]![enddate]

this assumes your input form is called 'DateSelect' of course

The following function is usefull to check if your form isloaded and I
think its included in the NorthWind database example.

Option Compare Database
Option Explicit

Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet
view.

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <>
conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView Then
IsLoaded = True
End If
End If

End Function

The NorthWind database will show you how to make a macro to take advantage
of this function.
The macro is associated with [ok] and [cancel] buttons of the form through
the events of the report.

hope it helps :)
 
Back
Top