Union query on calculated column

W

Wayne-I-M

Hi

I have a need to produce reports in Italian and English from a query
(I know you "could" use up to 7 IF's - but trying to see if there is a
better way)

eg.
I have a table - tblTrips
with a field [tripDayOut] (date)

I have created a simple table with the name of the week in English and Italian
tblDayTranslate
DayNumber 1, 2, 3, etc
DayUK Sunday, Monday, Tuesday,etc
DayItaia Domenica, Lunedì, Martedì, etc

I have tried a really simple UNION (which is not working) like this

SELECT Weekday([TripDayOut]) AS txtTransDay,
FROM tblTrips;
UNION SELECT tblDayTranslate.DayUK
FROM tblDayTranslate;

Maybe it's not possible to use a calculated coluumn like
Weekday([TripDayOut])
as the join.

Any ideas on how to link these two unrelated tables so I can get
Weekday([TripDayOut]) = the Italian name of the day

Thanks for any tips you can give.
 
K

KARL DEWEY

In design view put both tables in the open area above the grid.
Drag [DayNumber] into the Field row of the grid. Drag [DayItaia] into the
Field row of the grid.
Enter WeekDay([TripDayOut]) as Criteria for [DayNumber].
 
W

Wayne-I-M

Perfect

SELECT tblDayTranslate.DayNumber, tblTrips.TripOutDate,
tblDayTranslate.DayItalia, tblDayTranslate.DayUK
FROM tblDayTranslate, tblTrips
WHERE (((tblDayTranslate.DayNumber)=Weekday([TripOutDate])));


thanks for that

--
Wayne
Manchester, England.



KARL DEWEY said:
In design view put both tables in the open area above the grid.
Drag [DayNumber] into the Field row of the grid. Drag [DayItaia] into the
Field row of the grid.
Enter WeekDay([TripDayOut]) as Criteria for [DayNumber].

--
Build a little, test a little.


Wayne-I-M said:
Hi

I have a need to produce reports in Italian and English from a query
(I know you "could" use up to 7 IF's - but trying to see if there is a
better way)

eg.
I have a table - tblTrips
with a field [tripDayOut] (date)

I have created a simple table with the name of the week in English and Italian
tblDayTranslate
DayNumber 1, 2, 3, etc
DayUK Sunday, Monday, Tuesday,etc
DayItaia Domenica, Lunedì, Martedì, etc

I have tried a really simple UNION (which is not working) like this

SELECT Weekday([TripDayOut]) AS txtTransDay,
FROM tblTrips;
UNION SELECT tblDayTranslate.DayUK
FROM tblDayTranslate;

Maybe it's not possible to use a calculated coluumn like
Weekday([TripDayOut])
as the join.

Any ideas on how to link these two unrelated tables so I can get
Weekday([TripDayOut]) = the Italian name of the day

Thanks for any tips you can give.
 

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

Similar Threads

UNION QUERY.. 3
Union Query 4
Union Query by choice.. 11
UNION query question 7
Union Queries - Column Headers 3
Make table using Union Query 2
SUM in a UNION query 2
Duplicates in union query 3

Top