Results 1 to 6 of 6
  1. #1
    jheintz57 is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    28

    Open Report or Form depending on condition

    I have a form that needs to either open a report if one condition is met or open a form if that same condition is not met. i can do one as well as the other but I can't get them to work together. There seems to be an issue using Openform and Openreport together. Any help is appreciate. This is what I have so far:

    Private Sub RCRA_Continue_Click()

    If Me.[dot_transport?] = "-1" Then
    DoCmd.OpenForm "frm_DOT"
    Else


    DoCmd.OpenReport "output"
    End If

    End Sub


    The condition is DOT_Transport? and the Form is frm_DOT while the report is Output.

  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,521
    If that's a Yes/No field, it would be:

    If Me.[dot_transport?] = -1 Then

    or

    If Me.[dot_transport?] = True Then
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jheintz57 is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    28
    That doesn't seem to be the problem. It actually opens a print window with the "Report" as the object as the print.

  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,521
    If you want it on screen:

    DoCmd.OpenReport "
    output", acViewPreview

    There should not be an issue doing one or the other. If you still have a problem, can you post the db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    jheintz57 is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    28
    Perfect, don't know why I didn't even think of that....thank you so much!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Ah good, glad it helped. Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 02-26-2010, 08:14 AM
  2. Replies: 3
    Last Post: 01-14-2010, 08:32 AM
  3. open report from a vb form
    By tracamonali in forum Reports
    Replies: 2
    Last Post: 08-10-2009, 01:55 PM
  4. Highlighting Report Data Based on a Condition
    By KramerJ in forum Reports
    Replies: 1
    Last Post: 05-29-2009, 10:27 AM
  5. Using a form to apply a condition to a Query
    By JeepWidow in forum Forms
    Replies: 0
    Last Post: 12-22-2008, 10:29 AM

Tags for this Thread

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