Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005

    Unanswered: preview reports from a multi selection list box

    I have a form where I print reports from selections in a list box. It works fine.
    I have the need to preview the reports in a similar manner. I would like to be able to select reports(actually different instances of the same report) and have them display one at a time. Closing one opens the next. Here is the guts of the code.

    stDocName = "Mechanical"

    If Me![List4].ItemsSelected.Count > 0 Then
    MsgBox "Ready to Print"
    For Each well In Me![List4].ItemsSelected
    [Forms]![review form]![List4] = [List4].ItemData(well)
    DoCmd.OpenReport stDocName, acNormal, "", "[Well Data Master]![well name]=[Forms]![Review form]![List4]"
    Next well

    This code works well and loops through the multi select list box fine for printing. Just changing the report to acpreview doesn't work.
    It just displays the first report and wont go any further. I have been unable to find any help on this. Any help would be greatly appreciated.

  2. #2
    Join Date
    Feb 2004
    Chicago, IL
    If you are using Access 2000 or above (I might be wrong) you should be able to open the report as a Dialog using another parameter in the OpenReport method. Change:

    DoCmd.OpenReport stDocName, acNormal, "", "[Well Data Master]![well name]=[Forms]![Review form]![List4]


    DoCmd.OpenReport stDocName, acPreview, "", "[Well Data Master]![well name]=[Forms]![Review form]![List4]", acDialog

    Changing it to acDialog will pause the code execution until the previewed report is closed. In other words, it will wait until you have closed the open report until it tries to open the next one.

  3. #3
    Join Date
    Jul 2005
    Thanks!!! It worked like a charm. I've been looking for a solution to this for for a long time. Thanks again for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts