On Dirty style event for all pages of a tab control

R

Repent

I have a form that uses the tab control.
The tab control has 5 tabs/pages.
on the form's "on dirty" event i have code that changes the form to a
red color and plugs some warning text into a label control on the
bottom of the 1st page of the tab control. the warning states to the
user that they have changed a record and if they proceed the record
will be changed and saved. They can hit Esc to cancel the changes and
the warning box and red color go away.

I would like to have this same feature on all tabs because the user
can change the record anywhere on any tab.

I copied/pasted the label box from the first page of the tab control
to the other pages of the tab control. When I make a change to the
other tabs, other than the first tab, the box does change to red but
the text is not displayed. This tells me at least that the first part
of the code is running but the rest is not.

Here is the code I have so far:

Private Sub Form_Dirty(Cancel As Integer)
If Not Me.NewRecord Then

Me.Detail.BackColor = RGB(255, 100, 100)

Me.InfoMessage.Caption = "You have modified this record. " & _
"If you move to another record, your changes will be applied. " & _
"To cancel your changes, hit the Esc key (top left of keyboard)."
End If

End Sub


How do I modify the code to get the event to fire for any tab page
where the record is being changed?

thanks all;
chris
 
R

Repent

Linq;

I tried your second idea first as it's the simplest and it works so
I'm going with that. Thank you so very much!!

chris
 

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