473,386 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

HELP! Multiple Where's Type Mismatch

The following snipplet produces "Data type mismatch in criteria
expression". It must be someting simple. I will ultimately need this
where condition to contain 3 clauses. I am posting it with 2 thinking
I cna manage to get the 3rd on there with a little help from all of
you. The objective is to open a report based on 3 values supplied in a
form. Lemme know if you need more info. Here is the code and thanks
in advance.....

Private Sub Command7_Click()
On Error GoTo Err_Command7_Click

Dim stDocName As String
Dim SQLstring As Variant

SQLstring = "'" & "[mke_ID]= " & Forms!frm_Select!cmbo_Make & "'
And '" & "[inv_Model]= " & Forms!frm_Select!txt_Model & "'"
MsgBox (SQLstring)

stDocName = "rpt_Inv-COST"
DoCmd.OpenReport stDocName, acPreview, , SQLstring

Exit_Command7_Click:
Exit Sub

Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click

End Sub

Nov 13 '05 #1
1 1498
Your single single quotes are wrong. Assuming both mke_ID and inv_Model are
text fields, the quotes need to go around the value being passed, not the
field names:

SQLstring = "[mke_ID]= '" & Forms!frm_Select!cmbo_Make & _
"' And [inv_Model]= '" & Forms!frm_Select!txt_Model & "'"

Exagerated for clarity, that's

SQLstring = "[mke_ID]= ' " & Forms!frm_Select!cmbo_Make & _
" ' And [inv_Model]= ' " & Forms!frm_Select!txt_Model & " ' "

If mke_ID is numeric, you wouldn't need the single quotes:

SQLstring = "[mke_ID]= " & Forms!frm_Select!cmbo_Make & _
" And [inv_Model]= ' " & Forms!frm_Select!txt_Model & " ' "

Note, too, that if, for example, txtModel should contain a single quote in
it, you'll need to double up the single quotes in the value using Replace:

SQLstring = "[mke_ID]= " & Forms!frm_Select!cmbo_Make & _
" And [inv_Model]= ' " & _
Replace(Forms!frm_Select!txt_Model, " ' ", " ' ' ") & " ' "

(Remember to remove the extraneous spaces when copying that!)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

<mm****@gmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
The following snipplet produces "Data type mismatch in criteria
expression". It must be someting simple. I will ultimately need this
where condition to contain 3 clauses. I am posting it with 2 thinking
I cna manage to get the 3rd on there with a little help from all of
you. The objective is to open a report based on 3 values supplied in a
form. Lemme know if you need more info. Here is the code and thanks
in advance.....

Private Sub Command7_Click()
On Error GoTo Err_Command7_Click

Dim stDocName As String
Dim SQLstring As Variant

SQLstring = "'" & "[mke_ID]= " & Forms!frm_Select!cmbo_Make & "'
And '" & "[inv_Model]= " & Forms!frm_Select!txt_Model & "'"
MsgBox (SQLstring)

stDocName = "rpt_Inv-COST"
DoCmd.OpenReport stDocName, acPreview, , SQLstring

Exit_Command7_Click:
Exit Sub

Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click

End Sub

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
0
by: python-help-bounces | last post by:
Your message for python-help@python.org, the Python programming language assistance line, has been received and is being delivered. This automated response is sent to those of you new to...
2
by: Sudheer Kareem | last post by:
Dear All Please tell me how to assosiate help files with my Vb.net Project. Regards Sudheer
6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
0
by: tbatwork828 | last post by:
If you were like me trying to figure out how to launch context sensitive help topic by the context id, here is the link: http://weblogs.asp.net/kencox/archive/2004/09/12/228349.aspx and if...
27
by: Bruce Dodds | last post by:
I recently started using Access 2003 for the first time. I wanted to pass on some comments about the Help system to Access MVPs who frequent this board. I'm doing this in the hope that some of...
5
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time...
4
by: Fred Flintstone | last post by:
This one baffles me. I'm using VS.Net 2005 and write desktop apps that need built in help. So logically, I figure maybe VS has a help system component built in so I search the help. Hey! ...
1
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
0
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.