impossible to get date time values in a query

ryprobg

Member
Local time
Today, 09:28
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
 
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.
 
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
 
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()
 
Why are the fields short text in the table? I think that might be the problem.
 
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
 
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??
 
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)?
 
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
 
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.
 
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?
 
Is there any reason why you are storing dates as strings?

It usually leads to a world of pain!
 
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. :(
 
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

Back
Top Bottom