If then statements in Microsoft Access

  • Thread starter Thread starter cyb3rwolf
  • Start date Start date
C

cyb3rwolf

Hello. I have a form that has a combo list box that what i want to do is
when you change it to different text, to autopopulate a text box with certain
info... here is the code i have:
Private Sub Combo14_Change()
If Me.Approval = "THIS" Then
Me.Recipients = "THAT"
End If
End Sub

This appears to do nothing. anybody help me out?
 
Use the After Update event of the combo instead of the change event.
Does the combo have more than 1 column, is there a hidden column?

Jeanette Cunningham
 
Hello. I have a form that has a combo list box that what i want to do is
when you change it to different text, to autopopulate a text box with certain
info... here is the code i have:
Private Sub Combo14_Change()
If Me.Approval = "THIS" Then
Me.Recipients = "THAT"
End If
End Sub

This appears to do nothing. anybody help me out?

Use the AfterUpdate event (which fires when a new value is selected in
Combo14) rather than the Change event (which fires on every keystroke, and not
at all when the mouse is used); and make sure you're checking the right value.
What is Me.Approval? If you're looking for the newly selected value in Combo14
use Me!Combo14 - or rename the combo box to reflect its actual meaning, for
example if it's bound to the table field named Approval change its Name
property (and all references to it) to cboApproval.
 
John W. Vinson said:
Use the AfterUpdate event (which fires when a new value is selected in
Combo14) rather than the Change event (which fires on every keystroke, and not
at all when the mouse is used); and make sure you're checking the right value.
What is Me.Approval? If you're looking for the newly selected value in Combo14
use Me!Combo14 - or rename the combo box to reflect its actual meaning, for
example if it's bound to the table field named Approval change its Name
property (and all references to it) to cboApproval.
doh! that was is it. i never renamed the combo box. Thank you so much for
your help!
 
Back
Top