473,666 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble Entering Date Criteria in Access Query

3 New Member
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_transaction s]![post_date],4),Mid([dbo_transaction s]![post_date],5,2),Right([dbo_transaction s]![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 4831
ADezii
8,834 Recognized Expert Expert
@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
sh55555
3 New Member
@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 Recognized Expert Expert
@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
sh55555
3 New Member
@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 Recognized Expert Expert
@sh55555
Understood, but it inevitably gets converted into a SQL Statement. Can you Upload the dbo_Transaction s 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
5864
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 depending on a date range. (Today,Last 7 Days,Next 7 Days) The one I'm having problems with is the "Last 7 Days" Query.
10
2972
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 1jan2003. How do I remove the dates , 2jan2003 til 31jan2003 without removing them from the table, from the Query? (Because I want to use the data for 2jan2003 etc later in other queries) -kenneth
3
3120
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 tbl_vdc.batch_day = #9/24/2004#; But if I run the following query, it returns one record for
12
6366
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 ranges, ie between 24/09/2004 and 01/10/2004 together with 05/10/2004 and 07/10/2004 ? If I enter the "Between" criteria on different lines it returns no data.
3
2103
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 recordset is then filtered based on what was entered in the form. However, this strait forward approach seems to break when the form value to be passed to a query is a date. I have a format and input mask of ShortDate placed on the form. It is an...
2
6510
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. I then want to search through the records and select those with dates (as caluclated above) within a user defined range, and so I am using a parameter query. However, this query returns dates outside of the range and appears to have particular...
8
5679
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 many years I have until the renewal date, but for some reason, I cannot select just the ones for this year and next year (where datediff < 1) or even between 0 and 1. I can run the query fine without the criteria, but once I plug any kind of criteria...
10
3266
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 procedure to do this in VB.NET (2005 Express Edition). But I always get the message that the Jet database engine does not recognize the syntax (of the Date function I assume). I've also tried Now() and it works but only by itself. I seem to add or
1
9117
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 a table in Access with four fields
8
2476
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 have a parameter query consisting of 2 fields (month and year). The parameter prompts the user to enter the month and the year, that is, . When both are entered, there is no problem. Nevertheless, users may want only to enter the year, so as to...
0
8356
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
8783
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 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...
1
8552
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
8640
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 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...
0
7387
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...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2773
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
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.