Combo box set values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 fields:

1)Title combo box: "Mr";"Miss";"Mrs";"Ms"
2) Gender combo box: "M" or "F"

I was wondering how to get the form to insert into the Gender field to "M if
"Mr" is selected from the Title Combo box, and all the other titles to "F"?

Thanks
 
Use the AfterUpdate event of the Title combo box:

Private Sub Title_AfterUpdate()
Select Case Me.Title.Value
Case "Mr."
Me.Gender.Value = "M"
Case Else
Me.Gender.Value = "F"
End Select
End Sub
 
I have 2 fields:

1)Title combo box: "Mr";"Miss";"Mrs";"Ms"
2) Gender combo box: "M" or "F"

I was wondering how to get the form to insert into the Gender field to "M if
"Mr" is selected from the Title Combo box, and all the other titles to "F"?

Thanks

I take it that you are never going to use "Judge", "Dr.", "Reverend",
"Senator", "Congressman", etc. as a person's title?

Simple enough to do.
But then there is no need for the Gender combo box at all.
If you wish to keep the Gender field, change the combo box to a
regular text control, bound to the Gender field.

In the Title combo Box AfterUpdate event:
[Gender] = IIf(Me.Comboname = "Mr","M","F")

Again, as long as you have the title, and the gender can only be "M"
or "F", you can use criteria on the Title field to figure out, in a
query, form, or report just what the Gender is, using the same
expression as above.
 
Back
Top