473,396 Members | 1,789 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.

Trouble Entering Date Criteria in Access Query

I have built a query in Access using the DateSerial function to convert dates such as 20100401 to 04/01/2010. The query results work fine and the date is displayed correctly. I am now trying to enter criteria to query only certain dates. When I enter 04/01/2010 in the criteria field it displays a "data type mismatch error". I have tried entering the date criteria as #04/01/2010# and I get the same message. Ultimately I would like to create parameters to be able to enter a date range, however, I am having trouble just querying for a single date. The Date Serial expression looks like this:

Post Date: DateSerial(Left([dbo_transactions]![post_date],4),Mid([dbo_transactions]![post_date],5,2),Right([dbo_transactions]![post_date],2))


It displays the dates correctly (i.e. 04/01/2010) but it will not let me enter specific criteria.

Any suggestions?

Thanks for your help!
Apr 30 '10 #1
5 4817
ADezii
8,834 Expert 8TB
@sh55555
There is absolutely nothing wrong with your Expression that I can see, and as a matter of fact, I also testing between a Date Range with the following SQL Statement and all works well,
Expand|Select|Wrap|Line Numbers
  1. SELECT DateSerial(Left(dbo_transactions!post_date,4),Mid(dbo_transactions!post_date,5,2),Right(dbo_transactions!post_date,2)) AS [Post Date]
  2. FROM dbo_Transactions
  3. WHERE (((DateSerial(Left(dbo_transactions!post_date,4),Mid(dbo_transactions!post_date,5,2),Right(dbo_transactions!post_date,2))) Between [Enter Beginning Date] And [Enter Ending Date]));
Is the [Post_Date] Field defined as Text?
Apr 30 '10 #2
@ADezii
Yes, [Post_Date] is stored as text...does the DateSerial expression convert it to a date? Also, I understand your SQL statement, but I'm not using the SQL language in Access, I am just trying to type a date (i.e. 04/01/2010) in the "criteria" field in the design view of a query...does that make a difference?
Apr 30 '10 #3
ADezii
8,834 Expert 8TB
@sh55555
The DateSerial() Function returns a variant of SubType Date.
I'm not using the SQL language in Access
Not really sure what you mean.
Apr 30 '10 #4
@ADezii
I am not writing SQL Language literally...I am using the boxes in the Design View of an Access query where you can simply type the criteria you want without using actual SQL language
Apr 30 '10 #5
ADezii
8,834 Expert 8TB
@sh55555
Understood, but it inevitably gets converted into a SQL Statement. Can you Upload the dbo_Transactions Table with some sample Data in it so that I may test it?
Apr 30 '10 #6

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

Similar topics

6
by: carverk | last post by:
Hello All I'm in the middle of moving a MS Access DB to a MySql backend. I have figured out about 90% of the problems I have faced, execpt for this one. I have 3 Queries, which pull records...
10
by: Kenneth | last post by:
I have a Query that consist of a lot of different sales data, and one of the colums are different date. The date goes from 1jan2003 til 31jan2003. in this Query I only want the salesdata for...
3
by: Taji | last post by:
Can someone please explain this to me. When I run the following query in MS Access, it doesn't return anything. SELECT tbl_vdc.vcd_id, tbl_vdc.vcd_count, tbl_vdc.batch_day FROM tbl_vdc WHERE...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
3
by: bcaponet | last post by:
I have a form where a user enters a date that I will then base a query on. In the past, I have simply placed Forms!! into the criteria for a query and it runs as long as the form is open. The...
2
by: Julie Wardlow | last post by:
Help! I am calculating a future date using the DateAdd function in a query (the calculation also involves an IIf statement), and have managed to get this formula to produce the required result....
8
by: mjoytan | last post by:
In my real estate access database, I'm trying to create a report that will give me all the properties that are due for a lease renewal this year. I've been able to use datediff to tell me how...
10
by: Daniel | last post by:
In Microsoft Access I can write a query that includes the criteria: Between Date()-7 And Date() to retrieve the records from a table that fall within the last week. I'm trying to write a...
1
by: flumpuk | last post by:
Hi My job currently requires me to enter data from 300+ forms a month. The system which we used in Excel was slow , and theprevious guy had three workbooks for this job . I have created...
8
by: limperger | last post by:
Hello everyone! First and foremost, my apologies for the title of the post. It is not very clarifying of what the problem is about, but I didn't know how to put it... My problem is as follows: I...
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
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,...

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.