473,386 Members | 1,817 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.

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 2130
Try this:

CDate(DateSerial("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.googlegr oups.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 YourDateFieldName from Yourtablename where YourDateFieldName = #" &
Me.Sometextboxintheform & "#"

Linda
"Takeadoe" <mt********@msn.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.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
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...
7
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....
2
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...
6
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...
1
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...
1
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...
2
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...
5
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,...
4
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: 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
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
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...
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.