User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 397,810 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,523 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 2177 | Replies: 1 | Solved
Reply
Join Date: Sep 2006
Posts: 20
Reputation: saurabh_kanwar is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
saurabh_kanwar saurabh_kanwar is offline Offline
Newbie Poster

Type Mismatch Error

  #1  
Nov 7th, 2006
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2006
Posts: 20
Reputation: saurabh_kanwar is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
saurabh_kanwar saurabh_kanwar is offline Offline
Newbie Poster

Re: Type Mismatch Error

  #2  
Nov 8th, 2006
Thanks for your time guys. Problem's solved.

stCOND= "[MODEL_LN]='" & model & "'" And "[TM_NAME]='" & UN & "'"
The problem was in the line above.
"AND" was in VBA, not in text string so the following code worked by including "AND" within the quotes

stCOND = "[MODEL_LN]='" & model & "' AND [TM_NAME]='" & UN & "'"
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MS SQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 6:27 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC