What is the proper event to use ...

J

John Keith

in the case I want to change the caption on a command button when a different
record is loaded to the form?

I have a form/subform set up where the main form shows a SSN, Name and Title
and has a button that will either Create a schedule or delete/redefine a
schedule. The schedule for a person is shown in the sub-form. Most of the
records in the employee data table will not have a schedule (sub-form is
empty) and the button caption should show "Create Schedule". When the person
currently loaded HAS a schedule and the sub-form is showing it, the button
caption should say "Recreate Schedule"

I was thinking that the name box "OnChange" might work, but what are other
alternatives and any pros/cons associated with them?
 
D

Dirk Goldgar

John Keith said:
in the case I want to change the caption on a command button when a
different
record is loaded to the form?

I have a form/subform set up where the main form shows a SSN, Name and
Title
and has a button that will either Create a schedule or delete/redefine a
schedule. The schedule for a person is shown in the sub-form. Most of
the
records in the employee data table will not have a schedule (sub-form is
empty) and the button caption should show "Create Schedule". When the
person
currently loaded HAS a schedule and the sub-form is showing it, the button
caption should say "Recreate Schedule"

I was thinking that the name box "OnChange" might work, but what are other
alternatives and any pros/cons associated with them?


No, that's not the event to use. The Change event fires when the user
modifies the text displayed in the box, but not when the content changes as
you move from record to record.

For this, you should use the form's Current event. That event fires
whenever a new record becomes current on the form. So in that event, you
would check to see whether the record being displayed has a related schedule
record, and set the caption accordingly.

You would probably also use whatever process creates a schedule to set the
button caption to "Recreate Schedule", once a schedule has been created.
 

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