enable main frm cmd button when subfrm is dirty

hawg1

Registered User.
Local time
Today, 11:03
Joined
Sep 24, 2006
Messages
51
Hi,

Haven't used the 'ondirty' property before and am having trouble with it.

I have a main form (PersAction) with a subform (PersAction_PersData). After Insert button is click, subform appears ready for new data. click save works great. I wish to have an undo button on the main form become visible once data is entered into the subform. I've tried the following code in both the main form and subform 'Ondirty' property as an event and no luck:

Code:
If Me!PersAction_PersData.Dirty Then
        Me!cmdUndo.Enabled = True     ' Enable button.
    Else
        Me!cmdUndo.Enabled = False    ' Disable button.
    End If

Any help would be appreciated

thanks in advance

Hawg1
 
if your button is on the main form, i think you should put the code on the subform, something like:

if me.dirty then
me.parent.cmdbuttonname.visible = true
end if

hth
 
Save yourself some pain - If you just put this in the On Dirty event of the subform:

Code:
   Forms!YourMainFormName.YourCommandButtonName.Enabled = True

You'll have to put this in the ON Current event of the Main Form:
Code:
   Me.YourCommandButtonName.Enabled = False
 
Boblarson and Wazz,

Thanks for the tips. I went with Boblarson's approach and it works fine.

Thanks for the help and quick response

Hawg1:) :) :)
 

Users who are viewing this thread

Back
Top Bottom