Results 1 to 5 of 5
  1. #1
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99

    report based on a query

    Hi all is there any way to have a MsgBox to replace the popup dialog box of a report that is based on a query?
    I don't want the user confused by the criteria (forms!tblPartsOutbound!RepairID)
    I tried the code below, but it still pop up the criteria box...
    Any comment appreciated!

    Private Sub Command2_Click()



    Select Case MsgBox("Do you want view the Replaced Parts List of " & Me.txtRepairID & "?", vbYesNo, "Replaced Parts List By Repair ID")
    Case vbYes
    DoCmd.OpenReport "rptPartsOutbound", acViewPreview, , "[forms]![tblPartsOutbound]![RepairID] = '" & Me.txtRepairID & "'"
    Case vbNo
    Me.Undo
    End Select
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    That form reference is supposed to be a field in the report's source. The syntax is like this (it's the same for OpenReport and OpenForm):

    http://www.baldyweb.com/wherecondition.htm

    If you still have a criteria in your query for this same value, you should take it out. The wherecondition argument of OpenReport replaces it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    Thank you very much Paul!
    It works great. Never thought it could be this easy...
    And the website is very great too, I will take a deep look inside.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Happy to help, and thanks! I'm trying to make it a helpful tool.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    I'm very sure it's a very usefull website.
    It's a great job.

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

Similar Threads

  1. Report based on query
    By asmith in forum Reports
    Replies: 3
    Last Post: 10-07-2010, 10:24 AM
  2. Report based on query + sub-report (1:N relation)
    By BayerMeister in forum Reports
    Replies: 1
    Last Post: 08-19-2010, 03:26 AM
  3. Totals in a query-based report
    By babylikesburgh in forum Reports
    Replies: 4
    Last Post: 02-24-2010, 03:08 PM
  4. Replies: 1
    Last Post: 02-02-2009, 05:52 AM
  5. Problem with Report Based on a Query
    By gmalaret in forum Reports
    Replies: 1
    Last Post: 11-25-2008, 08:38 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