Results 1 to 2 of 2
  1. #1
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129

    VBA to open report

    I have a form where I can open the report specifically with the (open) record and it works well
    Private Sub btnIncPreview_Click()
    Dim strWhere As String
    If Me.Dirty Then 'Save any edits.
    Me.Dirty = False
    End If
    If Me.NewRecord Then 'Check there is a record to print
    MsgBox "Select a record to print"
    Else
    strWhere = "[IDEvent] = " & Me.[IDEvent]


    DoCmd.OpenReport "RptEvent", acViewReport, , strWhere
    End If
    End Sub
    I have another form where I want to enter in a box the IDEvent and open the report
    So I have a combo box (I might only need a text box with Number format) SearchBoxEventID
    Row Source query for IDEvent and btnEventReport with the vba
    Dim strWhere As String
    If Not IsNull(Me.SearchBoxEventID) Then
    strWhere = "IDEvent = " & Me.SearchBoxEventID (I also tried "Forms!frmEvent!IDEvent = but no)
    End If
    DoCmd.OpenReport "RptEvent", acViewReport, , strWhere
    the form frmEvent is not open at the time of this happening if it is the report opens but at the first ID no not the one i select
    any clues anyone

  2. #2
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    oh and there is no criteria in the query for this report but a parameter box comes up asking me to enter
    Forms!frmEventID, ?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. open report
    By fabiobarreto10 in forum Reports
    Replies: 3
    Last Post: 10-01-2012, 09:17 AM
  2. Open report in Report View
    By shariq1989 in forum Reports
    Replies: 3
    Last Post: 07-10-2012, 03:43 PM
  3. Open Report with 2 conditions
    By rck3 in forum Reports
    Replies: 11
    Last Post: 05-17-2012, 12:20 PM
  4. Open Report by Combo box
    By rck3 in forum Reports
    Replies: 2
    Last Post: 05-07-2012, 05:29 PM
  5. Report won't open
    By okakopa in forum Reports
    Replies: 1
    Last Post: 05-24-2010, 04:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums