By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,639 Members | 2,276 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,639 IT Pros & Developers. It's quick & easy.

Using the Union

P: 8
Hello All,
I'm having trouble using a union function with "insert into" function.
Maybe what I'm trying to do is not possible
Thanx for the help!
Farris

INSERT INTO [temp order_tbl] ( [part no], [part type], cost)
SELECT [model no], productdescription, unitprice
FROM model_tbl
WHERE [model no] = (forms![main_frm]![computer_lbx].Value)

UNION

INSERT INTO [temp order_tbl] ( [part no], [part type], cost)
SELECT [display no], productdescription, unitprice
FROM display_tbl
WHERE [display no] = (forms![display_frm]![displayList_lbx].Value);
Oct 24 '06 #1
Share this Question
Share on Google+
5 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Try this:

INSERT INTO [temp order_tbl] ( [part no], [part type], cost)
SELECT [model no], productdescription, unitprice
FROM model_tbl
WHERE [model no] = (forms![main_frm]![computer_lbx].Value)
UNION
SELECT [display no], productdescription, unitprice
FROM display_tbl
WHERE [display no] = (forms![display_frm]![displayList_lbx].Value);
Oct 24 '06 #2

Expert 5K+
P: 8,434
Try this:
...
I'm really curious about this. If you insert into a UNION query, how does Access know which of the "unioned" tables to put the record into?
Oct 24 '06 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
You can't insert into a UNION.

We're trying to Insert into a table the results of a UNION.
Oct 24 '06 #4

Expert 5K+
P: 8,434
You can't insert into a UNION.
We're trying to Insert into a table the results of a UNION.
Ah! Sorry about that, I muddled up the syntax. Guess I need to study up on my SQL - no real surprise there.
Oct 24 '06 #5

MMcCarthy
Expert Mod 10K+
P: 14,534
No need to be sorry

I still mess up badly on SQL sometimes. It can be a nightmare of logic.
Oct 24 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.