date format lost in UNION query

M

Marge

I've merged the results of 2 queries into a UNION query, however I suspect
that one of the fields [Eval Date] has lost it's date format. The reason I
think so is that the field displays as 1/10/06 instead of January 10 as my
formatting in the design view properties instructs (mmmm d). How can I
resolve this? Thanks for any help you can lend.
 
J

John Spencer

If you want the date formatted in a certain way in a UNION query then you have
two choices (that I can think of).

One:
Use the FORMAT function in the query to force the desired date into a string
that is formatted the way you want.

SELECT Format([TableName].[Eval Date],"mmmm dd") as [Eval Date]
FROM [TableName]
UNION
SELECT Format([OtherTable].[Other Date],"mmmm dd") as [Eval Date]
FROM [OtherTable]

Two:
Use the existing UNION query as the source table in another query. You should
then be able to set the date format for the field in the source table in this
new query.



John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
K

KARL DEWEY

instead of January 10 as my formatting in the design view properties
instructs (mmmm d).
Design view of what?
Are you not taking the data to a form or report? Format there.
 
M

Marge

The design view property for [Eval Date] of each of the queries used to
create the union query is set to format mmmm d. I am not taking the date to
a form or a report; I am creating a make table to add to another query which
will convert to Excel.

KARL DEWEY said:
instructs (mmmm d).
Design view of what?
Are you not taking the data to a form or report? Format there.

--
Build a little, test a little.


Marge said:
I've merged the results of 2 queries into a UNION query, however I suspect
that one of the fields [Eval Date] has lost it's date format. The reason I
think so is that the field displays as 1/10/06 instead of January 10 as my
formatting in the design view properties instructs (mmmm d). How can I
resolve this? Thanks for any help you can lend.
 
D

Dale Fye

instead of setting the "format" property of the field in the queries, you
will need to "format" the field directly. Something like:

Select Format([Eval Date], "mmmm d") as EvalDate
FROM yourTable

and will have to do this for both parts of the union query. This will
obviously change this value from a date to a string.

----
HTH
Dale



Marge said:
The design view property for [Eval Date] of each of the queries used to
create the union query is set to format mmmm d. I am not taking the date to
a form or a report; I am creating a make table to add to another query which
will convert to Excel.

KARL DEWEY said:
instead of January 10 as my formatting in the design view properties
instructs (mmmm d).
Design view of what?
Are you not taking the data to a form or report? Format there.

--
Build a little, test a little.


Marge said:
I've merged the results of 2 queries into a UNION query, however I suspect
that one of the fields [Eval Date] has lost it's date format. The reason I
think so is that the field displays as 1/10/06 instead of January 10 as my
formatting in the design view properties instructs (mmmm d). How can I
resolve this? Thanks for any help you can lend.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top