473,396 Members | 1,843 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,396 software developers and data experts.

Query with multiple criteria

Hi all. I need to add one more criteria to my query. Two will be taken from a combo box and third one will be from one of the fields from the query in form of a text. It is not working. Could someone help me please?

Expand|Select|Wrap|Line Numbers
  1.  
  2.     'Name of report to print
  3.     stDocName = "BARCODE SP kanban report w_trigger"
  4.  
  5.     'Name of query
  6.     strQueryName = "SP kanban query"
  7.  
  8.     'Where part from SQL statement - this is where I have the issue
  9. strSQL = "[Part_No]='" & Me.cboPartNumber & "'  And [Count]<= " & CInt(Me.cboQuantity.Value) & "'  And [color_name]= '" & color_name & "'"
  10.  
  11.      'Open report
  12.       DoCmd.OpenReport stDocName, acViewPreview, strQueryName, strSQL
  13.          DoCmd.Maximize
  14.  
  15.  
  16.  
Aug 27 '14 #1

✓ answered by MikeTheBike

Hi

You do not say what is actually happening, but you seem to have one too many apostrophes in you criteria ie
Expand|Select|Wrap|Line Numbers
  1. And [Count]<= " & CInt(Me.cboQuantity.Value) & "'
this apostrophe is not required if [Count] is numeric?

MTB

2 1443
MikeTheBike
639 Expert 512MB
Hi

You do not say what is actually happening, but you seem to have one too many apostrophes in you criteria ie
Expand|Select|Wrap|Line Numbers
  1. And [Count]<= " & CInt(Me.cboQuantity.Value) & "'
this apostrophe is not required if [Count] is numeric?

MTB
Aug 27 '14 #2
zmbd
5,501 Expert Mod 4TB
also you shouldn't use [Count] as a field name, it is a reserved word and will cause you issues:
Access 2007 reserved words and symbols
AllenBrowne- Problem names and reserved words in Access
Aug 27 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: ShyGuy | last post by:
I have a table with 4 fields. Three are used for criteria. I can get the DLookup to work with 1 criteria with the following but can't get it to work with 2 or three. NumofAppts = DLookup("",...
0
by: Greg Strong | last post by:
Hello All, In the past I've used a combo box with the 'row source' being an Access SQL union query to select "All" or 1 for only 1 criteria in a query. An example is as follows: SELECT 0 As...
3
by: developing | last post by:
Hello How do I specify multiple criteria for FindFirst or FindRecord (or anything else) that takes the criteria from a form. (text field and number field) edit: this will be in the after...
4
by: JHNielson | last post by:
I have a query that I'm trying to update with a dlookup with multiple criteria This is the string: EVNT_DT: DLookUp("","","( .EVNT_QTR=.) & (.=.)") When i run it it says it can't find the...
1
by: Tlou5831 | last post by:
I am attempting to compare 2 tables in my DB and find unmatched criteria. There are 2 different fields in each database that need to be compared. Tbl_AppUsers Role Settings INQ ...
3
by: kstevens | last post by:
Please help. I know the sysntax is wrong. Here are some details. I am looking for the sum of past shipped items. I originally wrote this Dsum with only one criteria, but because of multiple...
1
by: Brendan Wolf | last post by:
Happy Halloween all, I have been struggling at work with a DLookup using multiple criteria. I would like a text box to display the results of a DLookup based on the values selected in three...
3
by: Brendan Wolf | last post by:
Happy Halloween all, I have been struggling at work with a DLookup using multiple criteria. I would like a text box to display the results of a DLookup based on the values selected in three...
4
by: DANNYOCEAN | last post by:
I have a code that sucessfully calculates how many numbers are lower than for example 45 , for large sample number list. But i´m looking for a code that have a COUNT function with MULTIPLE...
3
by: M0ji | last post by:
I have created an update query to auto populate the value of one field based on the value of another field. I have two fields "Level" and "Document" if Document is A, Level needs to be 1 if...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.