Question : Access Query Too Complex Error with Union Query

Hello EE,

I am using Access 2007.  I have a table with 50 columns.  I have the long union query (below) that changes this to 50 rows for each record for each column (Field) and that row's value (Field Value).  (This is used for matching against another record source.)  I can run the union query without errors.  But, when I insert this union query into another query to make it a table I receive the Query Too Complex Error.  I need to get the data into this format for an immediate project.  Is there something wrong with the stucture of the union query, the length (limit?), or another way to do the same thing?

Thanks,
LVBarnes
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field01" AS ImportColumn, 
Field01DataTitle AS FieldName,
Field01DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field02" AS ImportColumn, 
Field02DataTitle AS FieldName,
Field02DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field03" AS ImportColumn, 
Field03DataTitle AS FieldName,
Field03DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field04" AS ImportColumn, 
Field04DataTitle AS FieldName,
Field04DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field05" AS ImportColumn, 
Field05DataTitle AS FieldName,
Field05DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field06" AS ImportColumn, 
Field06DataTitle AS FieldName,
Field06DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field07" AS ImportColumn, 
Field07DataTitle AS FieldName,
Field07DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field08" AS ImportColumn, 
Field08DataTitle AS FieldName,
Field08DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field09" AS ImportColumn, 
Field09DataTitle AS FieldName,
Field09DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field10" AS ImportColumn, 
Field10DataTitle AS FieldName,
Field10DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field11" AS ImportColumn, 
Field11DataTitle AS FieldName,
Field11DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field12" AS ImportColumn, 
Field12DataTitle AS FieldName,
Field12DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field13" AS ImportColumn, 
Field13DataTitle AS FieldName,
Field13DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field14" AS ImportColumn, 
Field14DataTitle AS FieldName,
Field14DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field15" AS ImportColumn, 
Field15DataTitle AS FieldName,
Field15DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
 
FileSection, ClaimTypeDesc,  
"Field16" AS ImportColumn, 
Field16DataTitle AS FieldName,
Field16DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
 
FileSection, ClaimTypeDesc,  
"Field17" AS ImportColumn, 
Field17DataTitle AS FieldName,
Field17DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc, 
"Field18" AS ImportColumn, 
Field18DataTitle AS FieldName,
Field18DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field19" AS ImportColumn, 
Field19DataTitle AS FieldName,
Field19DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field20" AS ImportColumn, 
Field20DataTitle AS FieldName,
Field20DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field21" AS ImportColumn, 
Field21DataTitle AS FieldName,
Field21DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field22" AS ImportColumn, 
Field22DataTitle AS FieldName,
Field22DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field23" AS ImportColumn, 
Field23DataTitle AS FieldName,
Field23DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field24" AS ImportColumn, 
Field24DataTitle AS FieldName,
Field24DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field25" AS ImportColumn, 
Field25DataTitle AS FieldName,
Field25DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field26" AS ImportColumn, 
Field26DataTitle AS FieldName,
Field26DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field27" AS ImportColumn, 
Field27DataTitle AS FieldName,
Field27DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field28" AS ImportColumn, 
Field28DataTitle AS FieldName,
Field28DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field29" AS ImportColumn, 
Field29DataTitle AS FieldName,
Field29DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field30" AS ImportColumn, 
Field30DataTitle AS FieldName,
Field30DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field31" AS ImportColumn, 
Field31DataTitle AS FieldName,
Field31DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field32" AS ImportColumn, 
Field32DataTitle AS FieldName,
Field32DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field33" AS ImportColumn, 
Field33DataTitle AS FieldName,
Field33DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field34" AS ImportColumn, 
Field34DataTitle AS FieldName,
Field34DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field35" AS ImportColumn, 
Field35DataTitle AS FieldName,
Field35DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field36" AS ImportColumn, 
Field36DataTitle AS FieldName,
Field36DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field37" AS ImportColumn, 
Field37DataTitle AS FieldName,
Field37DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field38" AS ImportColumn, 
Field38DataTitle AS FieldName,
Field38DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field39" AS ImportColumn, 
Field39DataTitle AS FieldName,
Field39DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field40" AS ImportColumn, 
Field40DataTitle AS FieldName,
Field40DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field41" AS ImportColumn, 
Field41DataTitle AS FieldName,
Field41DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field42" AS ImportColumn, 
Field42DataTitle AS FieldName,
Field42DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field43" AS ImportColumn, 
Field43DataTitle AS FieldName,
Field43DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field44" AS ImportColumn, 
Field44DataTitle AS FieldName,
Field44DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field45" AS ImportColumn, 
Field45DataTitle AS FieldName,
Field45DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field46" AS ImportColumn, 
Field46DataTitle AS FieldName,
Field46DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field47" AS ImportColumn, 
Field47DataTitle AS FieldName,
Field47DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field48" AS ImportColumn, 
Field48DataTitle AS FieldName,
Field48DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION 
SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field49" AS ImportColumn, 
Field49DataTitle AS FieldName,
Field49DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat
UNION SELECT DefaultCustNbr, 
FileSection, ClaimTypeDesc,  
"Field50" AS ImportColumn, 
Field50DataTitle AS FieldName,
Field50DataDesc AS ImportDescription 
FROM tblImportCustSchemaFlat;

Answer : Access Query Too Complex Error with Union Query

Hi,

I think the best solution is to create the empty destination table structure.
Create a query to truncate it (use delete * on access, access doesn't support truncate sql function)
Then split your big query into multiple stand-alone addition queries that add info in your destination table.
Then create a macro to execute all queries.

Stop loosing time to try to fix your big query !
I already solve this kind of problem with that method even if it seems too simple method.
Access doesn't support complex query !
Random Solutions  
 
programming4us programming4us