View Full Version : Dates


scossar
04-16-2002, 07:16 AM
Looking to output a static day and month with a variable year based on a date input on a form (UK dates)

So essentially if I was to enter a date of say 10/06/01 or 20/06/01 the output would be 31/10/01
if the input was 10/01/02 the output would read 31/10/02 ie the day and month don't change but the year reflects the year in the input

Thanks

Geoff Codd
04-16-2002, 07:29 AM
I think this is what you are looking for

Me!OutPutDate = Format("31/10/" & DatePart("yyyy", Me!InPutDate), "dd/mm/yy")

[This message has been edited by Geoff Codd (edited 04-16-2002).]

scossar
04-16-2002, 07:41 AM
forgot to say this is part of an IIF statement in setvalue macro

There is a combo box with a list of options and depending on the selection in that box and the date value entered, the calculation on the output may differ

"
IIf([Forms]![xxxxx]![typeselect]="1",DateAdd("d",28,(DateAdd("m",5,[Forms]![xxxxx]![yedate]))),"")
"
tried

"
IIf([Forms]![xxxxx]![typeselect]="2",Me!OutPutDate = "31/10/" & DatePart("yy", Me!OutPutDate),"")
"

but didnt work

"The object doesn't contain the automation object ME"

i'm new at this so just learning how these work

David R
04-16-2002, 08:00 AM
If you're calling it from a Macro you may need to refer to the form explicitly, instead of using Me.XXXX

Use the Expression Builder to help you get the right syntax. Probably something like: Forms!FormName.FormControlField

HTH,
David R