Make command button visible if anything changes on a form

I have a command button that by default is not visible.  But if any field data changes on the form I want the commnd button to appear.  How can this be done?
SteveL13Asked:
Who is Participating?
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
How about this:

Private Sub Form_Dirty(Cancel As Integer)
    Me.btnYourButtonName.Visible = True
End Sub

Now, this only will work for *Bound* controls ...

mx
0
 
SteveL13Author Commented:
The button is not a bound control.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Sorry ... that's ok because the button does not hold data.  I was referring to text boxes, combos, list boxes, option groups, etc.

So ... it should work.  Easy to try ...

mx
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Nick67Commented:
What mx means, is if you have unbound controls on the form, like combo boxes for building filters etc, the Dirty property doesn't change when you change those controls.
Dirty changes when something attempts to change the data bound to the form.
0
 
SteveL13Author Commented:
For some reason this is not working.  I have the button set to not visible by default.  So when the form is launched it does not show up.  Then when I make an entry or a change to any field on the form the button still does not display as I would like it to.

--Steve
0
 
Nick67Commented:
Simplify first
In the Form Dirty Event put

Msgbox "I'm Dirty"

Now, make a change (add a character and remove it)
Do you get a message box?
Save the record.
Do another control

Which ones cause a message and which don't?
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Steve ... can you show the code you used ?

mx
0
 
SteveL13Author Commented:
I sort of have this working but need a littel "tweak".  I have this in the ondirty event of the form...

    Me.Command517.Visible = True   (the visible property of Command517 is not visible by default.)

But when the user clicks the button that has become visible, the record is saved, and I want the button to not be visible again.  But it is remaining visible.

How can I make it not be visible once its been clicked?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.