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

    Unanswered: Open Only Reports which have a checkbox checked

    I have a split form with a print button this filters the results on if a checkbox is checked. I then need to open an existing reports with only the records showing which have been ticked but I am experencing no error message but the reports opens but opens all records in the report.

    Also if I need to put in a msgbox if no textboxes are checked what would it be ?

    Option Compare Database

    Private Sub Command228_Click()
    If Me.Print_Selected_Records = -1 Then
    Me.Filter = "([Print Selected Records] = True)"
    Me.FilterOn = True

    'Else If Me.Print_Selected_Records = 0 Then
    'msgbox "Please Select Record to Print"

    End If
    DoCmd.OpenReport "Car Permit Mail", acViewPreview, "Print Selected Records =" & Me.Print_Selected_Records
    End Sub

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

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

    Thank you

  2. #2
    Join Date
    Nov 2011
    Posts
    413
    If you just want to open to a specific record, then use something like
    DoCmd.OpenReport "YourReportName", acViewPreview, , "[YourPrimaryKey] = " & Me![YourPrimaryKey]

    Is that not what you want?

  3. #3
    Join Date
    Feb 2013
    Posts
    99
    In principle yes. But what I have is a form with colums first name last name and then a colum print report which os a checkbox what I want to do is open all

  4. #4
    Join Date
    Feb 2013
    Posts
    99
    (Sorry hit send on phone)
    Reports which are ticked by the user

    Thank you

  5. #5
    Join Date
    Nov 2011
    Posts
    413
    So, then just create a qry to select all records with Print_Selected_Records = -1 and then use the OnClickEvent of the CheckBox to run it.It of course needs to be an update qry. Hope this helps.
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "your querynamehere"
    DoCmd.SetWarnings True
    Me.Requery

Posting Permissions

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