PDA

View Full Version : Solved: Type Mismatch Error



Saurabhk
11-08-2006, 03:06 PM
Hi Guys,
Just wondering what's wrong with this coding

UN = Form_MAIN!LOGIN_DETAILS.Value
model = Form!COMBO_MODEL.Value
stDocName = "MODEL_SELECTION"

stCOND= "[MODEL_LN]='" & model & "'" And "[TM_NAME]='" & UN & "'"

DoCmd.OpenReport stDocName, acViewPreview, , stCOND

I'm getting a type mismatch error on the line where I specify value to stCOND.
If I run 2 conditions seperately one by one they run fine but when I join them using AND I get an error

Please Help

Ken Puls
11-08-2006, 03:18 PM
Just a guess, but try this:
stCOND = "[MODEL_LN]='" & model & "' AND [TM_NAME]='" & UN & "'"

It looks like your "AND" was in VBA, not your text string. You closed the quotes before it, and open them afterwards.

HTH,

Saurabhk
11-08-2006, 03:35 PM
Thank a lot. That works great. Never got such a fast response ever before.
You're a champ!!!!!

Ken Puls
11-08-2006, 03:40 PM
Never got such a fast response ever before.

LOL! Welcome to VBAX Saurabhk. :)