I have below Union Query that work fine if all five queries are imported. Some times crosswalk-4 and crosswalk-5 do not have any data to import which cause the union query to error out. Is there a work around to have the union query resume.
SELECT Trim([F1]) AS UIC, ([F5]) AS [UNIT NAME], DLookUp("[DIR_LIST1]","DIR_LIST qUERY","[ID]=1") AS [PARENT UIC]
FROM [CROSSWALK-1]
WHERE (((Len([f2]))=3 Or (Len([f2]))=4))
UNION ALL
SELECT Trim([F1]) AS UIC, ([F5]) AS [UNIT NAME], DLookUp("[DIR_LIST1]","DIR_LIST qUERY","[ID]=2") AS [PARENT UIC]
FROM [CROSSWALK-2]
WHERE (((Len([f2]))=3 Or (Len([f2]))=4))
UNION ALL
SELECT Trim([F1]) AS UIC, ([F5]) AS [UNIT NAME], DLookUp("[DIR_LIST1]","DIR_LIST qUERY","[ID]=3") AS [PARENT UIC]
FROM [CROSSWALK-3]
WHERE (((Len([f2]))=3 Or (Len([f2]))=4))
UNION ALL
SELECT Trim([F1]) AS UIC, ([F5]) AS [UNIT NAME], DLookUp("[DIR_LIST1]","DIR_LIST qUERY","[ID]=4") AS [PARENT UIC]
FROM [CROSSWALK-4]
WHERE (((Len([f2]))=3 Or (Len([f2]))=4))
UNION ALL
SELECT Trim([F1]) AS UIC, ([F5]) AS [UNIT NAME], DLookUp("[DIR_LIST1]","DIR_LIST qUERY","[ID]=5") AS [PARENT UIC]
FROM [CROSSWALK-5]
WHERE (((Len([f2]))=3 Or (Len([f2]))=4))
SELECT Trim([F1]) AS UIC, ([F5]) AS [UNIT NAME], DLookUp("[DIR_LIST1]","DIR_LIST qUERY","[ID]=1") AS [PARENT UIC]
FROM [CROSSWALK-1]
WHERE (((Len([f2]))=3 Or (Len([f2]))=4))
UNION ALL
SELECT Trim([F1]) AS UIC, ([F5]) AS [UNIT NAME], DLookUp("[DIR_LIST1]","DIR_LIST qUERY","[ID]=2") AS [PARENT UIC]
FROM [CROSSWALK-2]
WHERE (((Len([f2]))=3 Or (Len([f2]))=4))
UNION ALL
SELECT Trim([F1]) AS UIC, ([F5]) AS [UNIT NAME], DLookUp("[DIR_LIST1]","DIR_LIST qUERY","[ID]=3") AS [PARENT UIC]
FROM [CROSSWALK-3]
WHERE (((Len([f2]))=3 Or (Len([f2]))=4))
UNION ALL
SELECT Trim([F1]) AS UIC, ([F5]) AS [UNIT NAME], DLookUp("[DIR_LIST1]","DIR_LIST qUERY","[ID]=4") AS [PARENT UIC]
FROM [CROSSWALK-4]
WHERE (((Len([f2]))=3 Or (Len([f2]))=4))
UNION ALL
SELECT Trim([F1]) AS UIC, ([F5]) AS [UNIT NAME], DLookUp("[DIR_LIST1]","DIR_LIST qUERY","[ID]=5") AS [PARENT UIC]
FROM [CROSSWALK-5]
WHERE (((Len([f2]))=3 Or (Len([f2]))=4))