Share via

Is it possible to append a Union query?

Anonymous
2022-06-10T07:19:51+00:00

Hi I have a union query to show missed checks, so the query highlights channels that were not checked over a 24 hour period separated into 3 shifts, (6am-2pm, 2pm-10pm, 10pm-6am). The report for these missing checks is emailed every morning after 6am, what I would like to see is all the missed checks over a 7 day period in a summary (report).

My thoughts were to maybe append the daily results into a table and create a report from there, but is this possible to do from the union query and how to do it?

I have added my SQL for the union:

SELECT "Early Shift" As Shift, ChannelName, StartTime,EndTime,"Cage Checks" AS Quality

FROM CageNotCheckedEarlyShift

UNION ALL

SELECT "Late Shift", ChannelName, StartTime,EndTime, "Cage Checks" AS Quality

FROM CageNotCheckedLateShift

UNION ALL

SELECT "Night Shift", ChannelName,StartTime,EndTime, "Cage Checks" AS Quality

FROM CageNotCheckedNightShift

UNION ALL

SELECT "Early Shift" As Shift, ChannelName, StartTime,EndTime,"Carton Checks" AS Quality

FROM CartonNotCheckedEarlyShift

UNION ALL

SELECT "Late Shift", ChannelName, StartTime,EndTime, "Carton Checks" AS Quality

FROM CartonNotCheckedLateShift

UNION ALL

SELECT "Night Shift", ChannelName,StartTime,EndTime, "Carton Checks" AS Quality

FROM CartonNotCheckedNightShift

UNION ALL

SELECT "Early Shift", ChannelName, StartTime,EndTime, "Cracks & Acid Checks" AS Quality

FROM CrackAcidNotCheckedEarlyShift

UNION ALL

SELECT "Late Shift", ChannelName, StartTime,EndTime, "Cracks & Acid Checks" AS Quality

FROM CrackAcidNotCheckedLateShift

UNION ALL

SELECT "Night Shift", ChannelName, StartTime,EndTime, "Cracks & Acid Checks" AS Quality

FROM CrackAcidNotCheckedNightShift

UNION ALL

SELECT "Early Shift", ChannelName, StartTime,EndTime, "Flow Wrap Checks" AS Quality

FROM FlowWrapNotCheckedEarlyShift

UNION ALL

SELECT "Late Shift", ChannelName, StartTime,EndTime, "Flow Wrap Checks" AS Quality

FROM FlowWrapNotCheckedLateShift

UNION ALL

SELECT "Night Shift", ChannelName, StartTime,EndTime, "Flow Wrap Checks" AS Quality

FROM FlowWrapNotCheckedNightShift

UNION ALL

SELECT "Early Shift", ChannelName, StartTime,EndTime, "MVS Checks" AS Quality

FROM MVSNotCheckedEarlyShift

UNION ALL

SELECT "Late Shift", ChannelName, StartTime,EndTime, "MVS Checks" AS Quality

FROM MVSNotCheckedLateShift

UNION ALL

SELECT "Night Shift", ChannelName, StartTime,EndTime, "MVS Checks" AS Quality

FROM MVSNotCheckedNightShift

UNION ALL

SELECT "Early Shift", ChannelName, StartTime,EndTime, "Laser Marking Checks" AS Quality

FROM LaserMarkingNotCheckedEarlyShift

UNION ALL

SELECT "Late Shift", ChannelName, StartTime,EndTime, "Laser Marking Checks" AS Quality

FROM LaserMarkingNotCheckedLateShift

UNION ALL SELECT "Night Shift", ChannelName,StartTime,EndTime, "Laser Marking Checks" AS Quality

FROM LaserMarkingNotCheckedLateShift;

Thanks

Jo

Microsoft 365 and Office | Access | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2022-06-10T08:50:18+00:00

    Hi,

    Sure, you can simply build a new append query on the basis of the union query.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Duane Hookom 26,825 Reputation points Volunteer Moderator
    2022-07-01T14:31:49+00:00

    Do you have many tables with names like CageNotCheckedLateShift and CageNotCheckedNightShift?

    If this is the case I believe you have a serious issue with your table structures.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2022-07-01T06:18:44+00:00

    Hi Karl,

    I will give this ago and see how I get on. Thank you

    Jo

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2022-06-10T10:51:12+00:00

    Hi,

    Example in which sense?

    In the Access UI you create a new query, choose the union query as source and then you change the query type to an append query and handle the columns/fields.

    If you mean a SQL example it would be sth like:

    INSERT INTO tblTarget (Field1, Field2)
    SELECT qryUnion.Column1, qryUnion.Column2
    FROM qryUnion

    Depending on the target field types you may have to do some type conversions as in a union query everything becomes a text.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2022-06-10T10:35:57+00:00

    Hi Karl

    Do you have an example?

    Please

    Was this answer helpful?

    0 comments No comments