I'm sure this is a dumb question for you experienced VBers, but why do I get a runtime "Type Mismatch" error on this statement":
xPlan.CntyCd = IIf(IsNumeric(cmbCnty.Text), CInt(cmbCnty.Text), -1)
xPlan.CntyCd is defined as Integer
The ComboBox gives the user the option of selecting "ANY" or a county code number. Selecting the county code number works fine -- the "ANY" selection is what fails.
I've also tried the the following with the same results:
xPlan.CntyCd = IIf(cmbCnty.Text = "ANY", -1, CInt(cmbCnty.Text)
xPlan.CntyCd = IIf(IsNumeric(cmbCnty.Text), CInt(cmbCnty.Text), -1)
xPlan.CntyCd is defined as Integer
The ComboBox gives the user the option of selecting "ANY" or a county code number. Selecting the county code number works fine -- the "ANY" selection is what fails.
I've also tried the the following with the same results:
xPlan.CntyCd = IIf(cmbCnty.Text = "ANY", -1, CInt(cmbCnty.Text)