02-13-12, 08:14 #1Registered User
- Join Date
- Feb 2012
Unanswered: AfterUpdate Event VBA question involving checkbox and Combobox
I am trying to write VBA codes for an AfterUpdate event involving a numeric value, a checkbox, and a combobox.
Thre are three fields.
fieldone is a numeric value in a form. It was an automatically calculated value in a form using an AfterUpdate event.
fieldtwo is a checkbox.
fieldthree is a combobox with "Y" and "N".
Condition for fieldthree to display "Y" automatically: fieldone needs to be highter than 10 and fieldtwo needs to be checked (True)
Any other option, I would like fieldthree to display "N".
The following is what I've tried so far.
Question1: Do I need to do AfterUpdate event for both fieldone and fieldtwo?
or just for fieldthree.
Question2: The following codes doesn't seem to work. Please offer some idea. Thanks.
Private Sub fieldthree_AfterUpdate()
If (fieldone >= 10 And fieldtwo.Value = True) Then fieldthree.Value = "Y"
Else: fieldthree.Value = "N"
02-13-12, 08:37 #2Registered User
- Join Date
- Jan 2012
As you have explained it you will need AfterUpdate events for both fields. These events can be replicated and should read as follows for both fields:
If Me.FieldOne.Value > 10 And Me.FieldTwo= -1 Then Me.FieldThree.Value = "Y" Else Me.FieldThree.Value = "N" End IfHope this helps,
Access 2000 User