Dynamic command button function

Wysy

Registered User.
Local time
Today, 10:12
Joined
Jul 5, 2015
Messages
335
Hi,
May be the description is not precise, but here is what i am stucked with.
I have a navigation form with horizontal tabs. Each tab has its own target form. I would like to have one button on the top of the horizontal tabs that would have function depending on which form (tab) displayed. The
if currentproject.allforms("xxxx").isloaded then
docmd etc
works fine with individual forms loaded but not in the case of a navigation form.
I use the front end of this DB in x230 lenovo so i'd like to save space in the screen.
Any suggestion?
thanks
 
You could create a textbox in the main navigation form let's say CurrentFormName and then populate it by adding the following to each of the form open events of the forms in the tabs.
Code:
Me.Parent.CurrentFormName = Me.Name

The textbox probably wouldn't have to be visible.
 
I've used a similar technique on a single form where I used a combo box and then the button's caption and the vba code that gets run will change depending on the value of the combo box using case statements.
 
Thanks for the inputs. Just been away from my project. Now i am back. I will follow your recommendation. Thanks again
 

Users who are viewing this thread

Back
Top Bottom