Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

Which event to use?

I have a button on a form that is disabled by default.  I want to enable the button based on a Yes/No field in the DB record.  I use the standard navigation arrows at the bottom of the form to move forward and back in the table.

Which event do I use to put code to test the field and enable the button?.  Could I put something in the button Enabled property instead?
0
IBMJunkman
Asked:
IBMJunkman
3 Solutions
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Two places.

Form Current event and the Yes/No field AfterUpdate event

mx
0
 
mbizupCommented:
Use the form's Current Event, which runs when the form opens and as the user navigates through records..

You should also use the After Update event of the field that is being tested.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
" I want to enable the button based on a Yes/No field in the DB record. "
Well, IF ... that field in not a check box on the Form (?), then you only need the current event.


Private Sub Form_Current()

Me.YourCommandButtonName.Enabled = (Me![YourYesNoFieldName] = True)  ' or False

mx
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
hnasrCommented:
Form_Current event for a filled field.

If you need to modify the field then, as mbizup commented, you need to use the same code in the Yes/No field after update event.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
"as mbizup commented, "

:-)
0
 
IBMJunkmanAuthor Commented:
Both options were used.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now