Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2013
    Posts
    99

    Unanswered: Docmd.open Report not opening muliple filtered Results

    I have a split form with the following VBA which is required to print the selected records, in dataview is Five couloums "Surname" "Forename" "Permit Number" "Print Selected Coluoms" (which is True or False) and "ID" which is hidden

    on the Form is a button to print the seleced records with the following code

    The filter works and will open a different report if it is selected but if you select more than 1 it only opens the first reports and not all that have been selected

    Private Sub Command228_Click()
    If Me.Print_Selected_Records = -1 Then
    Me.Filter = "([Print Selected Records] = True)"
    Me.FilterOn = True
    DoCmd.OpenReport "Car Permit Mail", acViewPreview, , "[ID]=" & Me![ID]
    'DoCmd.PrintOut , , acHigh, 1
    'DoCmd.close acReport, "Car Permit Mail", acSaveNo
    Me.FilterOn = False

    ElseIf Me.Print_Selected_Records = False Then
    MsgBox "Please Select Permit to Print", , "No Selection Made"
    End If


    End Sub

    Thanks

  2. #2
    Join Date
    Feb 2013
    Posts
    99

    Resolved

    Changed the Where conditioning to open all reports that "[Print Selected Records] = " & True

    Heres the code should anyone find it useful

    If Me.Print_Selected_Records = -1 Then
    Me.Filter = "([Print Selected Records] = True)"
    Me.FilterOn = True
    DoCmd.OpenReport "Car Permit Mail", acViewPreview, , "[Print Selected Records] = " & True
    'DoCmd.PrintOut , , acHigh, 1
    'DoCmd.close acReport, "Car Permit Mail", acSaveNo
    Me.FilterOn = False

    ElseIf Me.Print_Selected_Records = False Then
    MsgBox "Please Select Permit to Print", , "No Selection Made"

    End If
    End Sub

    Private Sub Command231_Click()
    Dim myupdate As String
    DoCmd.Requery
    myupdate = "UPDATE CarPermittbl SET [Print Selected Records]=False;"
    DoCmd.SetWarnings False
    DoCmd****nSQL myupdate
    DoCmd.SetWarnings True
    Me.Print_Selected_Records.Requery
    End Sub

    Private Sub Command5_Click()
    DoCmd.close acForm, "Select Permits to Print", acSaveNo
    End Sub

    Private Sub Form_Load()
    Me.FilterOn = False
    DoCmd.MoveSize , , 7400, 6000
    End Sub


    Private Sub Form_Open(Cancel As Integer)
    Dim myupdate As String
    DoCmd.Requery
    myupdate = "UPDATE CarPermittbl SET [Print Selected Records]=False;"
    DoCmd.SetWarnings False
    DoCmd****nSQL myupdate
    DoCmd.SetWarnings True
    Me.Print_Selected_Records.Requery
    End Sub

Posting Permissions

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