?
Solved

Make command button visible if anything changes on a form

Posted on 2011-04-19
8
Medium Priority
?
294 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:SteveL13
  • 3
  • 3
  • 2
8 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 35428663
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
 

Author Comment

by:SteveL13
ID: 35428698
The button is not a bound control.
0
 
LVL 75
ID: 35428785
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 26

Expert Comment

by:Nick67
ID: 35430425
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
 

Author Comment

by:SteveL13
ID: 35432026
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
 
LVL 26

Expert Comment

by:Nick67
ID: 35434223
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
 
LVL 75
ID: 35434998
Steve ... can you show the code you used ?

mx
0
 

Author Comment

by:SteveL13
ID: 35439928
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question