Mismatch Evaluating Combobox Value List Choice

Fran Smith

New member
Local time
Tomorrow, 05:50
Joined
Oct 15, 2011
Messages
8
Hi all,

I've been going pretty well :), googling for answers, but this one stumps me. I have a combobox displaying 6 value list items. I'm using an If...Then statement to find out which option the user chose in order to,firstly, ascertain whether it is a valid choice when coupled with another combo box on the form and, secondly, to update another specific field on the form, ie. if A then update field A, if B then update field B etc.

I have done lots of this without problems, however this is the first time I've evaluated a combo box displaying a value list.

Here is the line that, when I step through, throws up a "Runtime Error 13, Type Mismatch":

If Me.cboType = "Clay" Or "Wood" Or "Ice" Or "Stone" Then

I've also tried:

If Me.cboType.value = "Clay" Or "Wood" Or "Ice" Or "Stone" Then

When I run and step through the application, choosing Clay in the combobox, the intellisense popping up says "Me.cboType.value = "Clay", which looks like it would work, which is frustrating. :(

So what datatypes am I mixing? I'm flummoxed! :eek:
 
VBA doesn't support that syntax, so it's:
Code:
If Me.cboType = "Clay" Or Me.cboType = "Wood" Or Me.cboType = "Ice" Or Me.cboType = "Stone" Then
 
Ah!! So simple! I obviously hadn't done multiple possibilities for an If..Then statement.:rolleyes: Thanks!:D
 

Users who are viewing this thread

Back
Top Bottom