In my report I want to add a dash to a date field, but only when it has data so it will read like this:
- 05/16/2018
I have tried setting the control source to:
iif(isnull(EndDate]), "", " - " & [EndDate]
but that gives an error.
In my report I want to add a dash to a date field, but only when it has data so it will read like this:
- 05/16/2018
I have tried setting the control source to:
iif(isnull(EndDate]), "", " - " & [EndDate]
but that gives an error.
You forgot to close the IIF statement
IIF(isNull(Enddate]),"","-" & [Enddate])
fairly simple answer this time but in the future, if you get an error, tell us what the error is - number and description. You'll get more focussed and faster help that waybut that gives an error.
If EndDate is a stored date field you won't be able to.
The dash wouldn't be an acceptable part of the date, or would turn it into a date somewhere near a black hole event horizon.
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
good point - you could use the format function
IIF(isNull(Enddate]),"",format([Enddate]," - dd/mm/yyyy"))
If you are doing this in the report you'll need an = at the front.
I'd probably create this in the query personallyCode:= IIF(isNull(Enddate]),"",format([Enddate]," - dd/mm/yyyy"))
DisplDate : IIF(isNull(Enddate]),"",format([Enddate]," - dd/mm/yyyy"))
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
Great idea!
Sometimes the best answers are the simplest and I'm trying to make this way more difficult than it needs to be.
Thank you!