Results 1 to 3 of 3
  1. #1
    Lockrin is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    52

    Automatically choose which report?

    I have 3 (as of right now) different reports that need to be run from the same data in a table. These reports are very similar but vary based on one value in the table. Field "Type" can have one of 3 values: "Flat Oval", "Round", or "Rectangular". I have a form with a button to run a report, but I need it to choose which report to run based on this value.

    I thought about using an IIf statement but I don't know if I should put it in the onclick of the button or how to structure it.



    Thanks in advance for any help.

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows XP Access 2003
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    let me get this straight you have a certain condition that is available on the form and based on that condition u would like to open a specific report try this. suppose the condition is in a textbo1.

    if me.textbox1=Condition1 then
    docmd.openReport ReportName1
    elseif me.textbox1=Comdition2 then
    docmd.openreport ReportName2
    else
    docmd.openreport ReportName3
    end if

    it is not clear whether you want to open the reports view particular reports if so you have to add a criteria if u need 2 do that please let me know. if this solves your problrm please mark this thread as solved

  3. #3
    Lockrin is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    52
    That wasn't exactly what I needed but it did get me on track enough to figure the rest out. Thank you very much, the exact code I used was

    If Me.Type = "Round" Then
    [Round].Visible = True
    [Rectangular].Visible = False
    [Flat Oval].Visible = False
    ElseIf Me.Type = "Rectangular" Then
    [Round].Visible = False
    [Rectangular].Visible = True
    [Flat Oval].Visible = False
    ElseIf Me.Type = "Flat Oval" Then
    [Round].Visible = False
    [Rectangular].Visible = False
    [Flat Oval].Visible = True
    Else
    [Round].Visible = False
    [Rectangular].Visible = False
    [Flat Oval].Visible = False
    End If

    P.S. I will try to mark it solved but am not 100% sure how to

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

Similar Threads

  1. Replies: 3
    Last Post: 09-26-2009, 01:57 PM
  2. Replies: 9
    Last Post: 04-28-2009, 05:42 PM
  3. Have database open automatically
    By Norman Masson in forum Access
    Replies: 6
    Last Post: 01-08-2008, 07:41 AM
  4. How do I choose multiple records for a report
    By admaldo in forum Reports
    Replies: 2
    Last Post: 03-03-2006, 06:02 AM
  5. automatically create queries
    By GEORGIA in forum Programming
    Replies: 8
    Last Post: 01-23-2006, 02:35 PM

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