DatePart problem with yyyy-mm-dd? (1 Viewer)

___

¯¯¯¯¯
Local time
Today, 22:08
Joined
Nov 27, 2003
Messages
595
Hi all,

I have a parameter query based on date which is the control source to a report. On the report I have a TextBox where I'd like to see the result of the parameter entered, this is no problem, but I need the format to be "mmyy" (0104) where at the moment it returns 12004. The query asks the user to enter the year (2004) and then the month number (1) so I thought I could get the desired result by using DatePart...

=[Enter Month Number ( ie Number 8 = August )] & DatePart("yy",[Enter Year ( ie 2004 )])

How wrong I was!!! Can anybody tell me what I'm doing wrong or is the problem in the date format from the query (yyyy-mm-dd)?

:confused:

TIA
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:08
Joined
Feb 19, 2002
Messages
43,282
The DatePart() function operates on a valid date. You are asking your user to input only a year. What are you intending to compare this to?
 

___

¯¯¯¯¯
Local time
Today, 22:08
Joined
Nov 27, 2003
Messages
595
Thanks Pat, I wasn't thinking :eek: Iv'e restructured the query and all works now :)
 

Users who are viewing this thread

Top Bottom