473,804 Members | 3,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

filter by form/selection MISMATCH in Criteria Expression

I recently asked the group for help on converting 3 numeric variables
to a new date variable. The DATESERIAL function below worked
perfectly! My question now relates to problems with this new variable
when I try to filter either by form or selection.

If I type 10/20/2005, just as you see it, with no quotes or other
punctuation, in the testHarvestDate field I get the following error
message: DATATYPE MISMATCH IN CRITERIA EXPRESSION and Access then locks
up on me!

What is the problem here? Any help would really be appreciated.

Regards,

Mike

testHarvestDate :
DateSerial((IIf ([harvest_month]=1,2006,2005)),[harvest_month],[day])

Feb 15 '06 #1
4 2151
Try this:

CDate(DateSeria l("yyyy", "mm", "dd)) where the date in the dateserial is
your important date. It sounds like it is treating DateSerial as a text
value.

Linda

"Takeadoe" <mt********@msn .com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
I recently asked the group for help on converting 3 numeric variables
to a new date variable. The DATESERIAL function below worked
perfectly! My question now relates to problems with this new variable
when I try to filter either by form or selection.

If I type 10/20/2005, just as you see it, with no quotes or other
punctuation, in the testHarvestDate field I get the following error
message: DATATYPE MISMATCH IN CRITERIA EXPRESSION and Access then locks
up on me!

What is the problem here? Any help would really be appreciated.

Regards,

Mike

testHarvestDate :
DateSerial((IIf ([harvest_month]=1,2006,2005)),[harvest_month],[day])

Feb 15 '06 #2
Linda,

Thank you for the reply. I tacked cdate on the front as suggested and
got the same error message. Any other suggestions?

Regards,

Mike

Feb 15 '06 #3
Okay, just thought of what that could be. In the query or SQL statement try
adding a # before where the date goes and right after it. Example:

Select YourDateFieldNa me from Yourtablename where YourDateFieldNa me = #" &
Me.Sometextboxi ntheform & "#"

Linda
"Takeadoe" <mt********@msn .com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
Linda,

Thank you for the reply. I tacked cdate on the front as suggested and
got the same error message. Any other suggestions?

Regards,

Mike

Feb 15 '06 #4
Linda - This is the code that creates the new date variable called
testharvestdate .

testHarvestDate :
DateSerial((IIf ([harvest_month]=1,2006,2005)),[harvest_month],[day])

I'm not sure where you want me to add the # - in the above or during
the actual filter? Okay, I guess my inexperience with Access is
shining through - loud and clear. I've been a SAS programmer for 15
years and using Access for a few weeks!
Your help and patience are much appreciated.

Mike

Feb 15 '06 #5

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

Similar topics

0
6476
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the report are based on the same View addressed in the Record Source of both as 'dbo.CLMain_vw'. The View resides in a SQL Server 2000 database. There are two different problems I am having with filtering: The first involves filtering in the form by date...
7
6291
by: damjanu | last post by:
Hi All; I need little help. I have a datasheet form. I allow user to do 'filter by selection'. My form contains a column with values. As user changes selections, I want to calculate totals. I can do this the first time the form loads.
2
2609
by: Terry | last post by:
I have cerated a Form, ExamsFrm, which is used to input details of exams taken at several Centres. It dosplays details from StudentTbl and has a SubForm which displays details from ExamsTble. I have incorporated some VB6 code as well as some Conditional Formatting. The code automatically updates CheckBoxes in the SubForm, depending on exam results, and the Conditional Formatting changes background colours, depending on CheckBox datum. ...
6
4631
by: Ralph2 | last post by:
Some time ago with a lot of help from this group I made a reasonably successful database to keep track of our shop drawings. However the searching mechanism is too complicated for the occasional user and I would like to change the whole process. I would like to duplicate the layout of my form... but each field becomes a simple "searching" ListBox. On completing any one search field all the rest are filtered to this value. Subsequent...
1
16392
by: lorirobn | last post by:
Hi, I have a report that works just fine. Now I would like to add the capability to choose selection criteria to limit what is displayed. I created several reports that do this, but they used VBA to create SQL statements, then apply them. Now that I have been using Access/VBA for awhile, I am wondering if there is a simpler way to do this than coding these long sql statements. My report has a query as its record source. Can I just...
1
1902
by: vunderusaf | last post by:
I have a listbox on a form that is selecting using named FinalQuery: SELECT ., ., . FROM FinalQuery; Now I have a text field with a date on this form and I'd like to use that date as the selection criteria, comparing to the ... how would I use a field with the WHERE clause?
2
5546
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by Form" in order to search for records based on this form, I would like to be able to enter a value in this "days" control so that I can filter records on the form based on this calculated interval (i.e., i want to search for records specifically where...
5
4022
by: DAHMB | last post by:
Hi all, Using Access 2007 I have a report called Sunday School Attendance based on a Query called qryAttendance the query is as follows: SELECT tblSundaySchoolAttendance.StudentID, tblSundaySchoolAttendance.AttendanceDate, . FROM tblSundaySchoolAttendance INNER JOIN ON tblSundaySchoolAttendance.StudentID=.StudentID;
4
5410
by: Rich P | last post by:
Maybe you could try using a query as the recordsource for your subforms and for the criteria field in the query you could use a Form parameter. This way - instead of using the form filter property you could set a value in a textbox on your mainform which would filter the query. This way all of your subforms are synchronized. fieldname: fldx Criteria: Like Forms!Form1!Text0 Text0 would be a textbox on your main form (Form1 or...
0
9705
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, 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...
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10567
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
10310
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
9138
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
5515
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
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4291
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
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.