Tab Control Change Question

G

Guest

Hello,

I have a 3 tabbed Tab Control. On tab2 (array #1), I have a command button
which calls a form. The values on that form are used to populate the labels
on tab2.

However, when I close the form, tab2 only repopulates when I click on
another tab, then back to tab2. This is due to the code associated with the
CHANGE property of that tab.

The question: How do I set that tab property to CHANGE when I exit the form
which I called from the command button OR, how can I call that code from the
form when I exit?

Thanks.
 
M

Marshall Barton

David said:
I have a 3 tabbed Tab Control. On tab2 (array #1), I have a command button
which calls a form. The values on that form are used to populate the labels
on tab2.

However, when I close the form, tab2 only repopulates when I click on
another tab, then back to tab2. This is due to the code associated with the
CHANGE property of that tab.

The question: How do I set that tab property to CHANGE when I exit the form
which I called from the command button OR, how can I call that code from the
form when I exit?


If you open the "other" form in dialog mode, the you can
call the Change event right after the OpenForm line:

DoCmd.OpenForm "otherform", WindowMode:=acDialog
tabcontrol_Change

If the other form stays open and you want to update the tab
page, the the other form can call the change procedure at an
appropriate time by using:
Forms!mainform.tabcontrol_Change
 
G

Guest

Thanks for your reply.

When using Forms!Master.TabCtl162_Change, I get the following error in code:

"Application-defined or object-defined error".


When I used your first suggestion(TabCtl162_Change), that did the trick...
I would rather use the 2nd option, as that code could be put in that
Procedure, and that Procedure called from several locations.

Finally, I was not clear that TabCtl162_Change after the form call was the
proper syntax. I thought TabCtl162.Change = True would be appropriate.
 
M

Marshall Barton

David said:
When using Forms!Master.TabCtl162_Change, I get the following error in code:

"Application-defined or object-defined error".


When I used your first suggestion(TabCtl162_Change), that did the trick...
I would rather use the 2nd option, as that code could be put in that
Procedure, and that Procedure called from several locations.

Finally, I was not clear that TabCtl162_Change after the form call was the
proper syntax. I thought TabCtl162.Change = True would be appropriate.


Make the Change event procedure Public so procedures outside
the form can refer to it.

Remember that a Public procedure in a class module
(including form modules) is a method of the class. This
means that the syntax to call the procedure is:
formobject.procedurename
which is consistent with all other property/method
references in Access.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top