impossible to get date time values in a query (1 Viewer)

ryprobg

Member
Local time
Today, 12:16
Joined
Sep 3, 2022
Messages
59
problem:
-I have two fields named [deb] ; [fin] as a short text in table t_rec
-Form to enter the informations in the table t_rec used as data source and [deb] ; [fin] is a date time field
-I creat a query to get values as date/time for today and i use as creatiria exp1 : datevalue([deb]) and date()
the problem is a error window appear picture in the attachements show the error
thank you for help

wind.jpg
 

jdraw

Super Moderator
Staff member
Local time
Today, 07:16
Joined
Jan 23, 2006
Messages
15,394
Please provide some context for your issue. What is the "business involved"? What are you trying to achieve? Can you show us your tables and relationships? More info please.
 

ryprobg

Member
Local time
Today, 12:16
Joined
Sep 3, 2022
Messages
59
Please provide some context for your issue. What is the "business involved"? What are you trying to achieve? Can you show us your tables and relationships? More info please.
i have many records i would make easy to use data i creat a query to get just records of today but is not work as shown in the problem
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:16
Joined
Oct 29, 2018
Messages
21,542
Hi. Do you have any data past today's date? If not, try removing your third column from the query and simply add the following criteria in the deb column.

>=Date()
 

XPS35

Active member
Local time
Today, 13:16
Joined
Jul 19, 2022
Messages
160
Why are the fields short text in the table? I think that might be the problem.
 

ryprobg

Member
Local time
Today, 12:16
Joined
Sep 3, 2022
Messages
59
Hi. Do you have any data past today's date? If not, try removing your third column from the query and simply add the following criteria in the deb column.

>=Date()
yes i have records of august mounth with all days
 

ryprobg

Member
Local time
Today, 12:16
Joined
Sep 3, 2022
Messages
59
Hi. Do you have any data past today's date? If not, try removing your third column from the query and simply add the following criteria in the deb column.

>=Date()
yes it wooooork great ..but if i want to get value of yasterday for example??
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:16
Joined
Oct 29, 2018
Messages
21,542
yes it wooooork great ..but if i want to get value of yasterday for example??
Please clarify that... Do you want records only from yesterday or all records since yesterday (meaning, including today's records)?
 

ryprobg

Member
Local time
Today, 12:16
Joined
Sep 3, 2022
Messages
59
Please clarify that... Do you want records only from yesterday or all records since yesterday (meaning, including today's records)?
one query for to get date of today
and an other query to get date of yesterday
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:16
Joined
Oct 29, 2018
Messages
21,542
one query for to get date of today
and an other query to get date of yesterday
To get yesterday's records, you could try this criteria.

>=Date()-1 AND < Date()

Please let us know if that works or not.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 07:16
Joined
May 21, 2018
Messages
8,605
The error message as far as I can translate
Says the datatype from the expression is incompatible with the critieria
There is no function in VBA called ValDate so that has to be a user defined function. I assume it is not returning a Date datatype needed by the criteria. What is ValDate? What is the datatype returned by this function?
 

cheekybuddha

AWF VIP
Local time
Today, 12:16
Joined
Jul 21, 2014
Messages
2,321
Is there any reason why you are storing dates as strings?

It usually leads to a world of pain!
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:16
Joined
Sep 21, 2011
Messages
14,451
Is there any reason why you are storing dates as strings?

It usually leads to a world of pain!
In the O/P's other thread the dates were actual dates with time element and we tried to explain that you cannot compare date and time with just a date and expect a match. :(
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:16
Joined
Oct 29, 2018
Messages
21,542
yes it work you are the best :)
Hi. Glad to hear you got it to work. Is that all you need, get records for yesterday or today? Do you have any need for entering a specific date (past or future) and get only the records for that day?
 

Users who are viewing this thread

Top Bottom