By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,223 Members | 1,608 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,223 IT Pros & Developers. It's quick & easy.

3 buttons to 1 form ( DoCmd.OpenForm)

P: 2
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.
Dec 9 '11 #1
Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,707
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 :
Expand|Select|Wrap|Line Numbers
  1. 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.
Dec 9 '11 #2

P: 2
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
Dec 9 '11 #3

NeoPa
Expert Mod 15k+
P: 31,707
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.
Dec 9 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.