Data Type mismatch fot text fiel when using datepart function incriteria

isuruk

Registered User.
Local time
Yesterday, 18:24
Joined
Mar 29, 2015
Messages
13
Hi I need urgent help. I have a query searching a database which stores the month and year in text. I use Monthname(DatePart("m", Date),False) to get the current month name and Datepart("yyyy", date) to get the current year for corresponding text fields. But the query gives a data type mismatch error. I tried using CStr(Monthname(DatePart("m", Date),False)) too :( PLS HELP :banghead:
 
Datepart returns a numeric value which you are trying to match to a text value

try

Format(Date(),"yyyy")
 
thank you soo much its worked!
:)
I used : MonthName(Format(Date(),"m"),False) for month
and Format(Date(),"yyyy") for year :)
 
The month name could also be done directly with Format.

Format(Date()),"mmmm")
 
I have another question
I want to create a query to find out the highest scorer for each event by adding points
but the problem is how to aggregate only for each event. Access wont allow creating the query without using group by on all selected fields :(
 
For a new and entirely unrelated question start a new thread in appropriate section
 

Users who are viewing this thread

Back
Top Bottom