Hi all,
I'm not sure if this is possible, but I need to be able to "select" or "press" a NavigationButton control through code, i.e., replicating all actions that would take place if I were to physically click the button with a mouse. I can get the NavigationSubform control to properly display the correct form through code, but I can't seem to get the appropriate NavigationButton to display as "pressed" (that is, to display the formatting specified in the PressedColor and PressedForeColor properties of the NavigationButton control).
I read Albert Kallal's solution to this problem here (https://groups.google.com/d/msg/comp...U/irzxAWKvPQsJ), which would work fine if my NavigationButton controls each contained a hard-coded form name in the NavigationTargetName property, but I am creating and loading my subforms on the fly via code that is executed through the OnClick event of each NavigationButton control, so the NavigationTargetName of each button is, by necessity, blank.
When actually clicking the NavigationButton control, the code behind the button loads the correct form in the NavigationSubform control and Access changes the formatting of the pressed button to indicate the "pressed" state; but when I attempt to replicate these actions through code, by calling the NavigationButton_Click() procedure, I can only get the right subform to display. I can't seem to get Access to recognize the button as "pressed". Instead, the button that was previously "pressed" remains in that state, creating a discrepancy between the visually "pressed" button and the form that is actually loaded in the subform control.
Any ideas? I've tried using the SetFocus method on the NavigationButton; I've tried SetFocus followed by SendKeys "Enter"; I've looked at the NavigationControl object that houses the NavigationButton controls to see if there was perhaps a way to set a particular NavigationButton control as "Selected"--i.e., something like NavigationControl0.Controls("NavigationButton1").S elected = True--but I couldn't find any documentation that such a property exists (though it must, since Access seems to "know" which control is pressed/selected at any given time). I've also scoured the MSDN library and Access forums for a solution, but can't find anything that works. I don't really want to get into manually setting colors/formatting in code if I can avoid it.
Thanks!
Dean