•
•
•
•
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
![]() |
•
•
Join Date: Sep 2006
Posts: 20
Reputation:
Rep Power: 2
Solved Threads: 0
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
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
•
•
Join Date: Sep 2006
Posts: 20
Reputation:
Rep Power: 2
Solved Threads: 0
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 & "'"
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 & "'"
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
- Type mismatch (ASP)
- Type mismatch: cannot convert from int to ResultSet (JSP)
- Help with asp error (ASP)
- how to sort out type mismatch error while retreiving attribute from LDAP (Visual Basic 4 / 5 / 6)
- how do i use selectionformula using 2 fields (Visual Basic 4 / 5 / 6)
- Info in Database converted to Chart (Visual Basic 4 / 5 / 6)
Other Threads in the MS SQL Forum
- Previous Thread: SQLDebugger, safe to delete?
- Next Thread: Report Header Problem


Linear Mode