473,811 Members | 3,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Cl ick

Dim stDocName As String
Dim SQLstring As Variant

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

stDocName = "rpt_Inv-COST"
DoCmd.OpenRepor t stDocName, acPreview, , SQLstring

Exit_Command7_C lick:
Exit Sub

Err_Command7_Cl ick:
MsgBox Err.Description
Resume Exit_Command7_C lick

End Sub

Nov 13 '05 #1
1 1518
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_Selec t!cmbo_Make & _
"' And [inv_Model]= '" & Forms!frm_Selec t!txt_Model & "'"

Exagerated for clarity, that's

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

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

SQLstring = "[mke_ID]= " & Forms!frm_Selec t!cmbo_Make & _
" And [inv_Model]= ' " & Forms!frm_Selec t!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_Selec t!cmbo_Make & _
" And [inv_Model]= ' " & _
Replace(Forms!f rm_Select!txt_M odel, " ' ", " ' ' ") & " ' "

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

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

<mm****@gmail.c om> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.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_Cl ick

Dim stDocName As String
Dim SQLstring As Variant

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

stDocName = "rpt_Inv-COST"
DoCmd.OpenRepor t stDocName, acPreview, , SQLstring

Exit_Command7_C lick:
Exit Sub

Err_Command7_Cl ick:
MsgBox Err.Description
Resume Exit_Command7_C lick

End Sub

Nov 13 '05 #2

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

Similar topics

21
6567
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 Workshop program: hcw.exe that's included with Visual Basic. This exact same file compiled perfectly with no notes, warnings or errors prior to reformatting my system. Prior to the reformatting, I copied the help.rtf file onto a CD and checked the box to...
0
2220
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 python-help, to point out a few resources that can help with answering your own questions, or improve the chances of getting a useful answer from the helpers. The most comprehensive overview of python.org help resources is at ...
2
6489
by: Sudheer Kareem | last post by:
Dear All Please tell me how to assosiate help files with my Vb.net Project. Regards Sudheer
6
3029
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 an html authoring tool to help you accomplish? 2. What do you expect from online help for a html authoring tool? 3. What audience do you think a freeware html authoring tool is directed towards?
0
568
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 link doesn't work, basically here is the article: An Exploration Into Launching Context-Sensitive HTML Help with Topic IDs in VB.NET I spent this evening investigating the HTML Help API as implemented in
27
2834
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 what I say may be passed on to Microsoft. Microsoft has implemented a combination local and web based help system in Access 2003. The local Help installed on your hard drive is fast, but the content is abbreviated. For really useful help you have...
5
3292
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 using "F1" help within the VB IDE. Is this expectation achievable In trying to test my help file in the IDE, I have a solution with 2 projects: the DLL and a tester. VB does not look for my help file; instead, it looks for path to my source code...
4
2260
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! Apparently, all I have to do is create a "Help Project"! There's my starting point. So the VS help says: "To create a Help project, click on the File menu, choose New and follow the wizard's instructions"
1
6142
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 default property of object Label. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"' Label = New Object(){Box1, Box2, Box3, Box4, Box5, Box6, Box7, Box8, Box9, Box10, Box11,...
0
2900
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 calls MS Excel, so the scenario is that I am supposed to see the Excel Menu bar, FILE EDIT VIEW INSERT ... HELP. I am able to see the menu bar, but in case of Help, I see the Help of Excel and help of my application, both as a submenu of help. ...
0
10651
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10403
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.