Command Button Enabled/Disabled

P

PeterM

I have the following command buttons on my form; New, Save, Undo, Delete and
First, Previous, Next and Last.

I'm having problems trying to enable and disable the buttons. For example,
If the form is not dirty, disable the Undo; enable the New; disable the Save.
If the record is saved, disable the Save button, etc. Can someone point me
somewhere to help me with this logic.

Thanks in advance for your help!
 
C

culupus61

PeterM said:
I have the following command buttons on my form; New, Save, Undo, Delete
and
First, Previous, Next and Last.

I'm having problems trying to enable and disable the buttons. For
example,
If the form is not dirty, disable the Undo; enable the New; disable the
Save.
If the record is saved, disable the Save button, etc. Can someone point
me
somewhere to help me with this logic.

Thanks in advance for your help!
 
M

Maurice

This will be a difficult one to solve because you can end up in various
scenarios where you have to check the activity of the users.

Normally you can set the values when you open the form as follows:

me.undo.enabled= false
me.new=not me.undo
me.save=me.new

etc.

But what if the user starts typing? At that point the form becomes dirty and
all the settings have to be reset to their counterparts. Then the user
presses the esc button (which normally fires the undo action). That means
that you might have to check the form current actions in every possible way.
Why not check when the button is pressed? Users will understand the checking
and validation when you redirect them to the point that there is nothing to
undo or save or create a new record. My advice would be to go with the
standard functionality from which your app will definitely benefit instead of
all the checking you heave to program which will not benefit your app.
 
M

Maurice

Good to hear you figured it out. Your answer might help somebody else so if
you are willing to place your technique pls do so.
 
D

De Jager

PeterM said:
I have the following command buttons on my form; New, Save, Undo, Delete
and
First, Previous, Next and Last.

I'm having problems trying to enable and disable the buttons. For
example,
If the form is not dirty, disable the Undo; enable the New; disable the
Save.
If the record is saved, disable the Save button, etc. Can someone point
me
somewhere to help me with this logic.

Thanks in advance for your 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