Enable control on continuos form

G

Guest

I want to only enable a save button when a record is either added or altered.
I have been able to use the me.dirty event to enable the button when changes
have been made on a single form but this does not seem to work on a continuos
form. ( the continuos form is a subform on a tab control if this is
significant). Is this expected and should I be using a different event in
this case.
Grateful for any help
 
G

Guest

Where is the Save button, and where are changes being made?

If the Save button is on the main form, and the code is attached to the
subform, use the Parent property of the subform to reference the command
button:

Me.Parent![YourCommandButton].Enabled = True

Hope that helps.
Sprinks
 
G

Guest

The button is definitely on the subform. I added a message box to the form
dirty code and this does not appear when I change a record leading me to
presume the event is not firing when I change a record- does the event fire
differently on continuos forms

Sprinks said:
Where is the Save button, and where are changes being made?

If the Save button is on the main form, and the code is attached to the
subform, use the Parent property of the subform to reference the command
button:

Me.Parent![YourCommandButton].Enabled = True

Hope that helps.
Sprinks

PeterW said:
I want to only enable a save button when a record is either added or altered.
I have been able to use the me.dirty event to enable the button when changes
have been made on a single form but this does not seem to work on a continuos
form. ( the continuos form is a subform on a tab control if this is
significant). Is this expected and should I be using a different event in
this case.
Grateful for any help
 
G

Guest

Peter,

No; the event fires the same way on both types of forms. Is it possible
that your OnDirty event procedure is attached to the Main form instead of the
subform? A change in a subform record fires the subform's OnDirty event but
not the main form's.

Sprinks

PeterW said:
The button is definitely on the subform. I added a message box to the form
dirty code and this does not appear when I change a record leading me to
presume the event is not firing when I change a record- does the event fire
differently on continuos forms

Sprinks said:
Where is the Save button, and where are changes being made?

If the Save button is on the main form, and the code is attached to the
subform, use the Parent property of the subform to reference the command
button:

Me.Parent![YourCommandButton].Enabled = True

Hope that helps.
Sprinks

PeterW said:
I want to only enable a save button when a record is either added or altered.
I have been able to use the me.dirty event to enable the button when changes
have been made on a single form but this does not seem to work on a continuos
form. ( the continuos form is a subform on a tab control if this is
significant). Is this expected and should I be using a different event in
this case.
Grateful for any help
 
G

Guest

Thanks for the help - it was me being stupid and your last comment made me
see it! - I placed the code on the forms using the editor and as a result the
event procedure links in the properties box weren't there - if that makes
sense

Sprinks said:
Peter,

No; the event fires the same way on both types of forms. Is it possible
that your OnDirty event procedure is attached to the Main form instead of the
subform? A change in a subform record fires the subform's OnDirty event but
not the main form's.

Sprinks

PeterW said:
The button is definitely on the subform. I added a message box to the form
dirty code and this does not appear when I change a record leading me to
presume the event is not firing when I change a record- does the event fire
differently on continuos forms

Sprinks said:
Where is the Save button, and where are changes being made?

If the Save button is on the main form, and the code is attached to the
subform, use the Parent property of the subform to reference the command
button:

Me.Parent![YourCommandButton].Enabled = True

Hope that helps.
Sprinks

:

I want to only enable a save button when a record is either added or altered.
I have been able to use the me.dirty event to enable the button when changes
have been made on a single form but this does not seem to work on a continuos
form. ( the continuos form is a subform on a tab control if this is
significant). Is this expected and should I be using a different event in
this case.
Grateful for any help
 
G

Guest

My pleasure. And "been there, done that!"

Sprinks

PeterW said:
Thanks for the help - it was me being stupid and your last comment made me
see it! - I placed the code on the forms using the editor and as a result the
event procedure links in the properties box weren't there - if that makes
sense

Sprinks said:
Peter,

No; the event fires the same way on both types of forms. Is it possible
that your OnDirty event procedure is attached to the Main form instead of the
subform? A change in a subform record fires the subform's OnDirty event but
not the main form's.

Sprinks

PeterW said:
The button is definitely on the subform. I added a message box to the form
dirty code and this does not appear when I change a record leading me to
presume the event is not firing when I change a record- does the event fire
differently on continuos forms

:

Where is the Save button, and where are changes being made?

If the Save button is on the main form, and the code is attached to the
subform, use the Parent property of the subform to reference the command
button:

Me.Parent![YourCommandButton].Enabled = True

Hope that helps.
Sprinks

:

I want to only enable a save button when a record is either added or altered.
I have been able to use the me.dirty event to enable the button when changes
have been made on a single form but this does not seem to work on a continuos
form. ( the continuos form is a subform on a tab control if this is
significant). Is this expected and should I be using a different event in
this case.
Grateful for any help
 

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