If then statements in Microsoft Access

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?
 
J

Jeanette Cunningham

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
 
J

John W. Vinson

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.
 
C

cyb3rwolf

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top