format row source as long date (1 Viewer)

tubar

Registered User.
Local time
Today, 17:40
Joined
Jul 13, 2006
Messages
190
the source table needs to be formatted as short date...my form is pulling data from a query and I would like to change the row source of my combo box on the form to be formatted in long date. row source is as followed
Code:
SELECT [qrydateSUM].[day of event] FROM qrydateSUM ORDER BY [day of event];
I have tried this with no luck
Code:
SELECT [qrydateSUM].format([day of event],"long date") FROM qrydateSUM ORDER BY [day of event];
also changing the format option in combo box doesn't work...im thinking to add a day column to query...but there has to be a way to change row source
 
Last edited:

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:40
Joined
Aug 30, 2003
Messages
36,128
Try

SELECT format([day of event],"long date") FROM qrydateSUM ORDER BY [day of event]
 

missinglinq

AWF VIP
Local time
Today, 18:40
Joined
Jun 20, 2003
Messages
6,423
Why not simply have a Calculated Field in your Query

Code:
[B]FormatAsLong: Format([day of event],"Long Date")[/B]

then use the Combobox Wizard and select the Field FormatAsLong to populate it?

Linq ;0)>
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 08:40
Joined
Jan 20, 2009
Messages
12,853
I am more inclined to question why the Format property of the control doesn't work.

I suspect the problem is the field in the table is text instead of Date.
 

missinglinq

AWF VIP
Local time
Today, 18:40
Joined
Jun 20, 2003
Messages
6,423
...I suspect the problem is the field in the table is text instead of Date...
Testing (in 2003/2007) shows that it doesn't matter, which really didn't surprise me. Access Functions are very tolerant, vis-à-vis accepting data that look like Dates as Dates.

I couldn't get it to Format a Date, in a SQL Statement, which is why I suggested doing the Format in the Query itself.

The trick, as I found out afterward, when I thought to check the SQL behind the Query, is it has to take the form of

Code:
SELECT Format([day of event],"Long Date") AS FormatAsLong FROM qrydateSUM;
which works just as well!

Linq ;0)>
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 08:40
Joined
Jan 20, 2009
Messages
12,853
Testing (in 2003/2007) shows that it doesn't matter, which really didn't surprise me. Access Functions are very tolerant, vis-à-vis accepting data that look like Dates as Dates.

Ah yes, that's right. Access will treat things that look like dates as dates. It will even silently convert mm/dd/yy and ISO strings to dates on systems where the Regional Settings are dd/mm/yyyy. Ever so helpful :rolleyes:.

However there must be some reason why the Format property is not working in that control. It certainly works for me even when the table is Short Date, as would be expected.

They could try spelling out the Long Date format in the control's Format property:
dddd", "d mmmm yyyy

Generally it is better to Format on the form than in the RecordSource query. (Especially if they want to be able to enter data on the form.)

I questioned because OP stated, "the source table needs to be formatted as short date" when nobody should care that much about the table format.
 

missinglinq

AWF VIP
Local time
Today, 18:40
Joined
Jun 20, 2003
Messages
6,423
...However there must be some reason why the Format property is not working in that control...

The syntax of the two attempts

[qrydateSUM].format([day of event],"long date")

Format([day of event],"long date")


is incorrect, it has to be

Format([day of event],"long date") AS CalculatedFieldName

with the

AS CalculatedFieldName

being the needed but missing part of the previous attempts.

Linq ;0)>
 

Users who are viewing this thread

Top Bottom