473,796 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date Error

Hello:

I have an access database that stores employee timings by date.
At the same time, I have a form that queries this database.
On the form I use a DTpicker to enable a user input the date for which
he/she wants data
When I execute the query below in my VB code, I get a run time error
that says
Error ===> "Datatype mismatch in criteria expression."
Query ===> cmdQuery.Comman dText = "SELECT * from tblTimings WHERE
fldDate = '" & dtpDate.Value & "'"

I don't understand why I get this error when
both, the field fldDate is of type Date/time and dtpDate.Value returns
the same. I tried setting both the DB date and the control date to
different date formats such as short date, long/general date, custom
date, but I still get the same error.
Appreciate any help on resolving this

Jul 17 '05 #1
3 5336
Hi

Try: fldDate = cvdate('" & dtpDate & "'")
instead

Svend
DK
<ka*****@gmail. com> skrev i en meddelelse
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hello:

I have an access database that stores employee timings by date.
At the same time, I have a form that queries this database.
On the form I use a DTpicker to enable a user input the date for which
he/she wants data
When I execute the query below in my VB code, I get a run time error
that says
Error ===> "Datatype mismatch in criteria expression."
Query ===> cmdQuery.Comman dText = "SELECT * from tblTimings WHERE
fldDate = '" & dtpDate.Value & "'"

I don't understand why I get this error when
both, the field fldDate is of type Date/time and dtpDate.Value returns
the same. I tried setting both the DB date and the control date to
different date formats such as short date, long/general date, custom
date, but I still get the same error.
Appreciate any help on resolving this

Jul 17 '05 #2
.... ups... theres a " too much
this is how: fldDate = cvdate('" & dtpDate & "')

Sorry
Svend

"Svend Erik Johansen" <cr****@mail.dk > skrev i en meddelelse
news:42******** *************@d read12.news.tel e.dk...
Hi

Try: fldDate = cvdate('" & dtpDate & "'")
instead

Svend
DK
<ka*****@gmail. com> skrev i en meddelelse
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hello:

I have an access database that stores employee timings by date.
At the same time, I have a form that queries this database.
On the form I use a DTpicker to enable a user input the date for which
he/she wants data
When I execute the query below in my VB code, I get a run time error
that says
Error ===> "Datatype mismatch in criteria expression."
Query ===> cmdQuery.Comman dText = "SELECT * from tblTimings WHERE
fldDate = '" & dtpDate.Value & "'"

I don't understand why I get this error when
both, the field fldDate is of type Date/time and dtpDate.Value returns
the same. I tried setting both the DB date and the control date to
different date formats such as short date, long/general date, custom
date, but I still get the same error.
Appreciate any help on resolving this


Jul 17 '05 #3
Should be

cmdQuery.Comman dText = "SELECT * from tblTimings WHERE
fldDate = #" & dtpDate.Value & "#"

That is if you are in the USA Europe and Australia will need to do this to
ensure consistent results

cmdQuery.Comman dText = "SELECT * from tblTimings WHERE
fldDate = #" &dtpDate.mon th & "/" & dtpDate.day & "/" dtpDate.year & "#"

SQL Process dates in US Date Format but will not throw an error if you feed
it dd/mm/yy instead it try's to fix it for you so it 1/4/05 will give be
processed as 4 January where as 13/4/05 will be processed as 13 April go
figure !


<ka*****@gmail. com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hello:

I have an access database that stores employee timings by date.
At the same time, I have a form that queries this database.
On the form I use a DTpicker to enable a user input the date for which
he/she wants data
When I execute the query below in my VB code, I get a run time error
that says
Error ===> "Datatype mismatch in criteria expression."
Query ===> cmdQuery.Comman dText = "SELECT * from tblTimings WHERE
fldDate = '" & dtpDate.Value & "'"

I don't understand why I get this error when
both, the field fldDate is of type Date/time and dtpDate.Value returns
the same. I tried setting both the DB date and the control date to
different date formats such as short date, long/general date, custom
date, but I still get the same error.
Appreciate any help on resolving this

Jul 17 '05 #4

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

Similar topics

10
1898
by: Jack | last post by:
Hi, I cannot get the date format correctly in dynamic sql statement, after trying various ways of handling it. I need some help with the date format in the following dynamic sql statement. Any help is appreciated in advance. While running the asp page, I still get an error as Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch: 'Format' DYNAMIC SQL STATEMENT:
15
18895
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract the value in timeonly format by using this command Format(now,"HH:mm:ss") But when I insert it into the Sql Server database, it embadded date value with it. the output looks like that "01/01/1900 08:59:00" in that case time is
32
5024
by: paul | last post by:
HI! I keep on getting this error and I have tried different things but I am not sure how to send the expiring date. The error that I am getting in Firefox 1.5 is "Error: expires.toGMTString is not a function" ---------------------------------------------------- I have this in a .js file and in the head section.
1
3029
by: JonathanParker | last post by:
Another quick one! Trying to search for records by both accounting period and by year in two seperate queries actioned by option buttons. I've sorted the formatting so it's in a UK format but I keep getting the same error '(3122) you tried to execute a query that does not include the specific expression 'tblAccounting.Period=0406 And tblProduction.DepartmentID=1 ?And tblUtility.UtilityID=1' as part of an aggregate function.' I can't...
6
14373
by: Jana | last post by:
Greetings Access Gurus! I am working on an app to send batch transactions to our bank, and the bank requires that we place an effective date on our files that is 'one business day in the future, excluding holidays and weekends.' I didn't want to build a table of holidays that would have to be continuously updated, so I searched high and low for a function that would tell me whether a given date was a holiday, to no avail. I did find an...
3
1626
by: bhavu10 | last post by:
hi i have created a form forreport with today, week month & year CMD Button but i think i wrote the code wrong for month and also it shows me only records for this year whewe as i have 2006 records too code is written in Event Procedure of Respective Cmd Button Can there be a problem in TODAY'S Cmd Button code that it shows me only 2007 record PLEASE HELP. Private Sub cmdMonth_Click()
2
2014
by: LadySugar | last post by:
Greetings! I have a database in access that contains information about the date members joined the company. Every year, membership must be renewed for each member. Usually I will send out a standard letter from a report to each member regardless of the date they joined. Members are only supposed to receive letters an exact year after they joined. I am wondering if it is possible for me to do a setting that will let me to create reports...
5
3447
Stang02GT
by: Stang02GT | last post by:
I have been asked to validate a date on our web-page so that people cannot enter dates like 14/1/08 or 2/30/06. I have found code that will do exactly what i need it to do, but i am not sure how to call it. It was suggested to be to have it run through an if statement and if the user enters an invalid date it will kick them to an error page. Here is the date validation code. // date validation using SimpleDateFormat // it will take a...
6
1390
by: DavidPr | last post by:
I have a website that allows people to post ads. Ads remain active for 30 days. In their control panel they can manage their ads, i.e., Edit, Delete, Renew, etc. In this case I'm working with the "Renew" feature. I want to show how many days they have left before their ad becomes inactive. When they submit an ad the date is recorded in the database using MySQL's DATE function. (I'm not interested in the "time", just the date). Here's how I...
0
9528
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
10228
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
10173
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
10006
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
9052
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
7547
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...
0
5441
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...
1
4116
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
3
2925
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.