Question : Design question on being able to select multiple records on the form

I have a very basic form, on the form (suppose the query behind the form is the simplest one: select * from sampleTable), when you double click it, the record where the mouse is clicked will be selected and it will open a report (the date on this record will be the query parameter for the report query):
  DoCmd.OpenReport "rptRealReport1", acViewPreview, , fltSQL1
 
Now what I need is to be able to select multiple records on the form, and when user double clicks the mouse, it will open multiple windows (reports) corresponding with the multiple selected records.
 
Any help is appreciated on how to do it.

Answer : Design question on being able to select multiple records on the form

I assume you are referring to selecting records in a continuous form.

The simplest solution for this is to add a yes/no field to your table and allow users to set this for the required records.
If you have multiple users, you woud probably have to take a local copy of (at least part of)  the table to prevent conflicts.

It is possible to handle multiple selections in a continuous form using the  record selector bar, provided the selected records are contiguous.  This involves using the Selheight property of the form.  However, it won't work for non-contiguous selections and for that reason I never use it.

Opening multiple copies of the same report requires different code to a standard Openreport.
To make it possible at all , you must force the creation of the report's code module (adding a test for 1 = 1 in the report header format event procedure is sufficient) , if you have no other code in the report.

You can then use standard module code like the example below to open multiple versions.  In this example, if the recordsource for the report 'rptOrders1' was based on a parameter query, then each new version asks for the parameter, so you can get 5 different versions of the same report on the screen at the same time.

Sub multiplerpts()
Dim rpt As Report_rptOrders1
Dim i As Integer

     For i = 1 To 5
         Set rpt = New Report_rptOrders1
         rpt.Visible = True
         DoEvents
         Set rpt = Nothing
     Next i

End Sub







Random Solutions  
 
programming4us programming4us