473,513 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using the Union

8 New Member
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
5 1929
MMcCarthy
14,534 Recognized Expert Moderator MVP
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
Killer42
8,435 Recognized Expert Expert
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
14,534 Recognized Expert Moderator MVP
You can't insert into a UNION.

We're trying to Insert into a table the results of a UNION.
Oct 24 '06 #4
Killer42
8,435 Recognized Expert Expert
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
14,534 Recognized Expert Moderator MVP
No need to be sorry

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

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

Similar topics

4
7596
by: jonnychang | last post by:
What is the purpose of using union in this class? Class A { public: union { int age; char * name; double amount; } };
1
478
by: Adrian | last post by:
Dear All I've come across a strange issue when using UNION via MyODBC on my Fedora linux box (I'm using MySQL 4.1.3-standard-beta) **This doesn't work: (select a from tbl_name where a=10...
5
1822
by: REH | last post by:
Hi. I want to have a union that contained various types, some of which are classes with constructors. I'm attempting to acheive this with placement new. Please tell me if the following code...
10
5587
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
12
2875
by: Susan Bricker | last post by:
For those of you who have been following my posts - they all pertain to a Dog Competition Organization's Database. There are three classes that the dogs can participate: NOVICE, OPEN, and...
14
2161
by: Clint Olsen | last post by:
I was wondering if it's considered undefined behavior to use a member of a union when it wasn't initialized with that member. Example: typedef unsigned long hval_t; hval_t hval_init(void) {...
1
5459
by: suslikovich | last post by:
Hi all, I am getting this error when insert values from one table to another in the first table the values are varchar (10). In the second they are datetime. The format of the data is mm/dd/yyyy...
13
4997
by: Kantha | last post by:
Hi all, I have declared an Union as follows typedef union { struct interrupt_bits { unsigned char c_int_hs_fs_status : 1, c_setup_intflag : 1,
5
3816
by: wugon.net | last post by:
question: db2 LUW V8 UNION ALL with table function month() have bad query performance Env: db2 LUW V8 + FP14 Problem : We have history data from 2005/01/01 ~ 2007/05/xx in single big...
3
7700
by: SRK | last post by:
Hi, I wanted to use an anonymous union within an structure something like below - struct Test { union { std::string user; //char user; std::string role; //char role;
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7160
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7537
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5086
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3233
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1594
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.