View Full Version : FormatDateTime in query?


intern42
06-26-2003, 07:38 AM
I'm using a query to populate a combo box with three fields, one of which is a date/time field.

I'm concatinating the three fields in the SQL statement so that all three will be visible in the combo box when selected.

i.e. SELECT Table.field & " " & Table.field & " " & Table.field AS...

I need the time field to be in short time format, so I tried doing this:

SELECT ... FormatDateTime(Table.field, vbShortTime) ...

However, I get an error that this isn't a valid function.
It works in VB, but I guess Access doesn't allow it in a query?

I'd normally get around this by adjusting the property of the combo box, but I don't believe this would work as the combo box is being populated by 3 fields concatenated into one.

Any suggestions?

MattS
06-26-2003, 09:24 AM
Try:

Format(Table.Field,"short time")

intern42
06-26-2003, 10:01 AM
Hey, that worked!

Thanks a ton!