Time functions

  • Thread starter Thread starter bdobs
  • Start date Start date
B

bdobs

Guest
I am having difficulty expressing time in custom formats.
I have the following code for a column in a query:
RELEAS_DATE: IIf([RELEASE_DATE]=#1/1/1900#,"",[RELEASE_DATE])

The format of RELEAS_DATE is mm/dd/yy
I would like the true case to result in a mm/yy format for the following options:

- the current month
- RELEAS_DATE(this would strip out the day)
- a text box containing a date

Also,
Are there any good resources that give multiple examples of situations where you have a complex statement which needs to combine a number of controls/functions etc to yield a result?(I often find that these type of combinations result in errors b/c the exact syntax is not correct)
Thanks.
 
I'm not sure what your asking, but here it goes.

If you want the column in you query to show a "mm/yy" format then the formula should be:

iif(RELEASE_DATE= #1/1/2000#,"", format(RELEASE_DATE,"mm/yy"))

if you asking how you can limit the amount of code you put it query, cause starting to get pretty messy and it's hard to debug, then you might want create a function in an module like this:

function dateCheck(dateZ)
if dateZ = #1/1/2000# then
dateCheck = ""
else
dateCheck = format(datez,"mm/yy")
end if
end function

then call this function in your query column like this:
dateCheck(RELEASE_DATE)

then you can make the function as messy as you want.
[This message has been edited by bobjames (edited 05-16-2000).]

[This message has been edited by bobjames (edited 05-16-2000).]

[This message has been edited by bobjames (edited 05-16-2000).]
 
Thanks, that should do the trick-
The only thing I was missing was the parenthesis surrounding the mm/yy
 

Users who are viewing this thread

Back
Top Bottom