3 buttons to 1 form ( DoCmd.OpenForm)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ldeman2
    New Member
    • Dec 2011
    • 2

    3 buttons to 1 form ( DoCmd.OpenForm)

    Im new to VB/Access. I have a table listing employee information and then 3 different queries that seperate the employees by job title (Waiters, Dishwashers, Bartenders). What i would like to do is have 3 buttons (1 for each) that when pushed opens a form displaying all the information in a report. The kicker is the template for the report will remain the same, only the title will change (either waiter, bartender, or dishwasher). I see no reason to create 3 different reports with the same design and different titles. How do i have 1 report but have the title change based on the category.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32662

    #2
    Are you wanting to open a form? Or a report? Your question indicates confusion on this score. Either will require a very similar solution mind you, but it never hurts to know what the question actually is.

    Opening forms (and reports are done very similarly) is done using the VBA command :
    Code:
    Call DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs)
    We're interested only the WhereCondition and/or OpenArgs parameters.
    1. The WhereCondition parameter filters the data in the form being opened. When the form is open this value (the full string) is available to the code as Me.Filter.
    2. The OpenArgs parameter is purely for passing information across, so a properly formatted title could be used here.


    A further alternative, that of updating the Value or Caption of the title control after the new form has been opened, is also available to you.

    These are your options. Determining which is the most appropriate for your situation requires a much better explanation of your situation.

    Comment

    • ldeman2
      New Member
      • Dec 2011
      • 2

      #3
      Sorry, that was a bit confusing reading back over it. I have a form with 3 buttons on it for user to push to open a report. If the user pushes the bartender button it will open a report listing the bartender information that i have already entered into a table. The format of the Report wil look the same regardless of which button is pushed except the title. Hope that explains it better

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32662

        #4
        That's somewhat clearer, but only covers that single confusion. It adds very little to the question as a whole. There is still very little info about what you are working with, that also should have been included in the question, but there's also no response to the solution options (albeit in necessarily general terms as I have so little to work with) supplied in post #2.

        Comment

        Working...