this is driving me crazy. i need to use a form control as a criteria
in a select query, and the control's value is set depending upon what
a user selects in an option group on the form. the query results
should return information on either a single employee or all
employees.
the problem that i have is that if i type in "*" (but without quotes)
in the QBE criteria, it works fine. however, if i use Iif() to
determine whether or not there is a value in the control and then use
* if there is not, i get a "data type mismatch" error. the empID field
is a numeric field.....so, that makes sense, but i don't understand
why * works if typed in, but not if you use a function or a form
control. i suspect it's because of a string / numeric data type
difference.
the question boils down to how do i use "*" or "like *", by using Iif
or a function (i've also created a function that returns * and that
doesn't work either) without explicitly typing it in?
thanks for any help you can offer. 3 3972
See http://www.mvps.org/access/queries/qry0001.htm
(Q) I'm using a control on a form as a parameter for my query. I've
defined the criteria in the query as
Forms!myForm!my Control
How do I set this up so that if the field is left blank, all records are
returned by the query?
(A) Change the criteria in the query to
Forms!myForm!my Contrl OR forms!myForm!my Control Is Null
I also use
nz([parameter],[tablename].[fieldname])
so take your pick.
Peter lk****@cox.net (Laurel) wrote in news:28aa456e.0 310131706.1e334 627
@posting.google .com: this is driving me crazy. i need to use a form control as a criteria in a select query, and the control's value is set depending upon what a user selects in an option group on the form. the query results should return information on either a single employee or all employees.
the problem that i have is that if i type in "*" (but without quotes) in the QBE criteria, it works fine. however, if i use Iif() to determine whether or not there is a value in the control and then use * if there is not, i get a "data type mismatch" error. the empID field is a numeric field.....so, that makes sense, but i don't understand why * works if typed in, but not if you use a function or a form control. i suspect it's because of a string / numeric data type difference.
the question boils down to how do i use "*" or "like *", by using Iif or a function (i've also created a function that returns * and that doesn't work either) without explicitly typing it in?
thanks for any help you can offer.
thanks to both of you!
i used Forms!myForm!my Contrl OR forms!myForm!my Control Is Null
and it worked like a charm. i'm new to this. obviously. thanks again! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ArcadeJr |
last post by:
Good morning all!
I have been getting a Run-time Error message #3464 - Data Type mismatch
in criteria expression. While trying to run a query.
I have a database where the field Asset_Number was once a type Number,
but I had to change it to a type Text due to I needed to have two zeros
at the beginning of the Asset Number (EX: 001234.)
The rease I am writing is that now when I run from My Query Menu a
|
by: igor.barbaric |
last post by:
Hello!
I have created a very simple query like this:
SELECT Tasks.Name, DurationHrs(,) AS
Duration
FROM Tasks INNER JOIN Log ON Tasks.TaskID=Log.TaskID;
The above query works fine. "Tasks.Name" is a "Text" field with
description of task, while "DurationHrs" is a VB function that
calculates number of hours between two "DateTime" values and returns
|
by: Igor Barbaric |
last post by:
Hello!
I have created a very simple query like this:
SELECT Tasks.Name, DurationHrs(,) AS
Duration
FROM Tasks INNER JOIN Log ON Tasks.TaskID=Log.TaskID;
The above query works fine. "Tasks.Name" is a "Text" field with
description of task, while "DurationHrs" is a VB function that
calculates number of hours between two "DateTime" values and returns
|
by: bleighfield |
last post by:
Hi everyone
Hope someone can help with this one..
Background:
I work in vehicle fleet, I have built something to 'predict' when a
car/van service is due (it's fairly simple, calculates miles per day
between 2 known dates/mileages and then uses the service schedule to
work out what date the next service would be due, selecting the 'closer'
|
by: aaronrm |
last post by:
I have a real simple cross-tab query that I am trying to sum on as the
action but I am getting the "data type mismatch criteria expression"
error. About three queries up the food chain from this cross-tab
query I am using a simple query with no grouping where I am filtering
some data out in the criteria line.
I have been out of access for a couple years but I remember in the
past I had a solution for this but I can't remember. Any help...
| |
by: psychomad |
last post by:
Please, can someone help me out to solve this error, i've been
searching throughout my codes and yet i didnt succeed in finding the
error!!!!
The Error is:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Data type mismatch in criteria expression.
|
by: blackburnj55 |
last post by:
Hi,
I am constructing a website for a bike shop. I am using dreamweaver and an access database to create it.
I have made a query where two criteria are entered to get results. These are : Category and price(RRP).
Here is the SQL:
"SELECT Category, Description, Image, ProductRef, RRP, SalePrice FROM BOM WHERE Category = '" + Replace(Recordset1__MMColParam, "'", "''") + "' AND RRP < '" + Replace(Recordset1__MMColParam2, "'", "''") +...
|
by: Lysander |
last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the date is more than 10 months out.
The query runs fine, but I when I put the criteria of >10 I get 'Data Type mismatch' error. The code below is the original query. I have since put all the datediff bit in code, with all variables declared as date,...
|
by: nixonmg |
last post by:
When the Command Button "Notify" is clicked, I am wanting to send out an email to the user with appropriate information in the email (works great), check the "Notified" check box (does not work), and disable the "Notify" button (works).
After the email is sent off, i get a Data type mismatch in criteria expression error. I am completely stumped. Any help would be greatly appreciated! Here is my code (I removed the email portion as it is...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |