Show one of many buttons based on combobox. Or open specific form based on combobox.

jmkeuning

New member
Local time
Today, 07:32
Joined
Sep 1, 2016
Messages
9
I have a subform which contains resources for cases. Each case will have many resources and each resource has their own kick-off form. What I want to do is have a button on each record of the subform that opens a different form depending on the value in the resource combobox.

(Even as I write this I realize that the visibility of the button might not be the best way to get where I am going!)

The button will open a form which is specific to the chosen resource. It will literally be as simple as if combobox=ResourceONE then open form frmKickoff_ONE, if combobox=Resource2 then open form frmKickoff_TWO, etc...

Since this is a subform on the main form frmCases, the button opens the form filtered on the case and resource.

Code:
DoCmd.OpenForm "frmKickoff_ONE", , , "CaseName='" & Me.CaseName & "' And ResourceName ='" & Me.ResourceName & "'"

My thought was to create a bunch of buttons and show/hide based on the combobox, but I think there is probably a better way! Any and all suggestions are welcome. Thanks.
 
I'm still trying to guess what your business might be and what exactly you are trying to do.

If Resource means "user" genericly, and kickoff form means a startiing form to deal with a case(s), then perhaps you can have a login form. When a Resource logs in --put their name (and whatever) into a control (could be on a hidden form), and update a Common form with the name of the Resource to make it look "more customized".
If I have totally missed with my guess, just disregard this post.

Good luck.
 
Use one button and read the combo value in the Click procedure to decide which form to open.

I would put the form name in a hidden column of the combo.

Code:
DoCmd.OpenForm Me.comboname.Columns(1), , , "CaseName='" & Me.CaseName & "' And ResourceName ='" & Me.ResourceName
 
In what way are forms frmKickoff_ONE and frmKickoff_TWO different?

Very subtly. These resources are vendors in the same business, and they all need generally the same information. The information is close enough that it is all stored in the same table. Some vendors might need primary and back-up contacts for example, where others only need primary. Rather than present a form with all fields for all vendors I want to limit the form to collect only the information needed by the relevant vendor.
 
As a general rule, if you have subtle differences then only have one form, then modify it with VBA for each scenario to show/use the subtle differences...

My VBA-foo is too weak for that.

But I am getting better. For now I will make a few forms, and then as we tweak the information that needs to be collected for each Resource I will look at making one form and using VBA to show/hide some things. Thanks!
 

Users who are viewing this thread

Back
Top Bottom