Pick list for report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Have a database that stores the minutes of meetings in a table called
"tblMinutesOfMeeting".
I have a query called "qryMinutesOfMeeting" that has a date parameter so the
user can select a specific date for the particular recorded minutes
interested in when the "rptMinutesOfMeeting" is run. This depends on the user
to remember the specific date that the minutes were recorded and can be a
hassle at times because of the random dates of when some of the meetings are
recorded. It would be nice and more user friendly when the report ran that it
would let the user pick a specific date from a list of "minutes" sorted by
dates and pull that one up on the report screen.

Any suggestions will be greatly appreciated,

Thanks for your time

ksr
 
Have a database that stores the minutes of meetings in a table called
"tblMinutesOfMeeting".
I have a query called "qryMinutesOfMeeting" that has a date parameter so the
user can select a specific date for the particular recorded minutes
interested in when the "rptMinutesOfMeeting" is run. This depends on the user
to remember the specific date that the minutes were recorded and can be a
hassle at times because of the random dates of when some of the meetings are
recorded. It would be nice and more user friendly when the report ran that it
would let the user pick a specific date from a list of "minutes" sorted by
dates and pull that one up on the report screen.

Any suggestions will be greatly appreciated,

Thanks for your time

ksr


Place a listbox on a form and name lstReportPick. Set it's RowSource
to a query that gathers the info you want to display in the choices.
If the record of the minutes has an index or unique identifier, make
this the bound column - otherwise make the date column the bound
column. Place a Preview and/or Print button and create an event
proceedure for the Click event. Make sure you're not setting the same
parameter in the query and in the event.

Private Sub PreviewReport_Click()
On Error Goto stoprun

If Nz(Me!lstReportPick,"")="" Then
MsgBox "Please choose a meeting date to
continue",vbOkOnly,"Invalid Selection"
Exit Sub
Else
Docmd.OpenReport "rptName",acPreview,,"[fieldname] = #" & Me!
lstReportPick & "#"
End If

Exit_Here:
Exit Sub

stoprun:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Here
End Sub
 
There are a few ways how to do it.

1) Create a form.
2) Add a ListBox and name it lstDates.
3) lstDates.RowSource = "SELECT DISTINCT qryMinutesOfMeeting.fldYourDate
FROM qryMinutesOfMeeting"
4) lstDates.MultiSelect = 2 (it will enable you to select more than one date
at once)
5) Add a button btnPrint.

On btnPrint:
6) Go through lstDates.ItemsSelected and create a filter-string, eg.
"fldYourDate in (#07/05/05#, #07/05/06#)"
7) DoCmd.OpenReport "rptMinutesOfMeeting", acViewNormal, strFilterStringHere

or if lstDates.MultiSelect = 0
6) do nothing here :-)
7) DoCmd.OpenReport "rptMinutesOfMeeting", acViewNormal, "fldYourDate =
lstDates.Value"

You may need to translate lstDates.Value to SQL, eg. May 5, 2007 =
#07/05/05#

Hope it'll work for you... at least after some small corrections.

Vlado
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top