Problems with my code???

  • Thread starter Thread starter James
  • Start date Start date
J

James

I have the following SQL QUERY:

-----------------------------------------------------------

Select Title, CD as MediaType, tblCDs as BaseTable from
[tblCD's]
UNION
Select Title, [DVD Title] as MediaType, [tblDVD's] as
BaseTable from [tblDVD's]
UNION
Select Title, VCD as MediaType, tblVCDs as BaseTable from
[tblVCD's]
UNION
Select Title, Software as MediaType, tblSoftware as
BaseTable from tblSoftware
UNION
Select Title, MP3Title as MediaType, tblMP3Title as
BaseTable from tblMP3Title
UNION
Select Title, [MP3's on CD] as MediaType, tblMP3List as
BaseTable from tblMP3List;

-----------------------------------------------------------

It keeps prompting me for Title,CD,tblCD's and other
random things...

All I want is a simple UNION query... I have had help with
this one from people in these newsgroups....

What could be thr problem?

all I want it a UNION query to unite all my tables
together so that I can search it as I am creating a search
form...

Many Thanks

James
 
Are Title, CD, tblCds columns in the table [tblCD's]? At
its simplest, the structure of a UNION query is
SELECT colA, colB etc FROM TableA
UNION
SELECT colD, colE etc FROM TableB
etc
The two main rules are that the number of columns selected
in each part of the union must be the same and that the
datatypes of the respective columns must be the same i.e.
in the above example the datattype of colA must be the same
for colD and the datatype for coleB must be the same for colE

Hope This Helps
Gerald Stanley MCSD
 
No there not.. tblCDs is the table name...

CD is just nothing...

Title I would refer that to being CD Title....

But I will try what you have suggested and see how it
goes...

Many Thanks

James
-----Original Message-----
Are Title, CD, tblCds columns in the table [tblCD's]? At
its simplest, the structure of a UNION query is
SELECT colA, colB etc FROM TableA
UNION
SELECT colD, colE etc FROM TableB
etc
The two main rules are that the number of columns selected
in each part of the union must be the same and that the
datatypes of the respective columns must be the same i.e.
in the above example the datattype of colA must be the same
for colD and the datatype for coleB must be the same for colE

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have the following SQL QUERY:

--------------------------------------------------------- --

Select Title, CD as MediaType, tblCDs as BaseTable from
[tblCD's]
UNION
Select Title, [DVD Title] as MediaType, [tblDVD's] as
BaseTable from [tblDVD's]
UNION
Select Title, VCD as MediaType, tblVCDs as BaseTable from
[tblVCD's]
UNION
Select Title, Software as MediaType, tblSoftware as
BaseTable from tblSoftware
UNION
Select Title, MP3Title as MediaType, tblMP3Title as
BaseTable from tblMP3Title
UNION
Select Title, [MP3's on CD] as MediaType, tblMP3List as
BaseTable from tblMP3List;

--------------------------------------------------------- --

It keeps prompting me for Title,CD,tblCD's and other
random things...

All I want is a simple UNION query... I have had help with
this one from people in these newsgroups....

What could be thr problem?

all I want it a UNION query to unite all my tables
together so that I can search it as I am creating a search
form...

Many Thanks

James
.
.
 
Ok... I have tried your UNION query at its simplist...
here it is and it tells me that its invalid braceting??

-----------------------------------------------------------

SELECT
[CD Album Title],
Null
From tblCD's;
UNION SELECT
[DVD Title],
Null
FROM tblDVD's;
UNION SELECT
MP3Title,
Null
FROM tblMP3Title;
UNION SELECT
[MP3's On CD],
Null
FROM tblMP3List;
UNION SELECT
[Software Title],
[Type of Software]
FROM tblSoftware;
UNION SELECT
[VCD Title],
Null
FROM tblVCD's;

-----------------------------------------------------------

What brackets do I need I have tried the following:

{} [] () "" ''

What do I have to do to make this thing work?

Many Thanks

James :)
-----Original Message-----
No there not.. tblCDs is the table name...

CD is just nothing...

Title I would refer that to being CD Title....

But I will try what you have suggested and see how it
goes...

Many Thanks

James
-----Original Message-----
Are Title, CD, tblCds columns in the table [tblCD's]? At
its simplest, the structure of a UNION query is
SELECT colA, colB etc FROM TableA
UNION
SELECT colD, colE etc FROM TableB
etc
The two main rules are that the number of columns selected
in each part of the union must be the same and that the
datatypes of the respective columns must be the same i.e.
in the above example the datattype of colA must be the same
for colD and the datatype for coleB must be the same for colE

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have the following SQL QUERY:

--------------------------------------------------------
-
--
Select Title, CD as MediaType, tblCDs as BaseTable from
[tblCD's]
UNION
Select Title, [DVD Title] as MediaType, [tblDVD's] as
BaseTable from [tblDVD's]
UNION
Select Title, VCD as MediaType, tblVCDs as BaseTable from
[tblVCD's]
UNION
Select Title, Software as MediaType, tblSoftware as
BaseTable from tblSoftware
UNION
Select Title, MP3Title as MediaType, tblMP3Title as
BaseTable from tblMP3Title
UNION
Select Title, [MP3's on CD] as MediaType, tblMP3List as
BaseTable from tblMP3List;

--------------------------------------------------------
-.
 
It is the punctuation in the table names that is causing
the problems.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Ok... I have tried your UNION query at its simplist...
here it is and it tells me that its invalid braceting??

-----------------------------------------------------------

SELECT
[CD Album Title],
Null
From tblCD's;
UNION SELECT
[DVD Title],
Null
FROM tblDVD's;
UNION SELECT
MP3Title,
Null
FROM tblMP3Title;
UNION SELECT
[MP3's On CD],
Null
FROM tblMP3List;
UNION SELECT
[Software Title],
[Type of Software]
FROM tblSoftware;
UNION SELECT
[VCD Title],
Null
FROM tblVCD's;

-----------------------------------------------------------

What brackets do I need I have tried the following:

{} [] () "" ''

What do I have to do to make this thing work?

Many Thanks

James :)
-----Original Message-----
No there not.. tblCDs is the table name...

CD is just nothing...

Title I would refer that to being CD Title....

But I will try what you have suggested and see how it
goes...

Many Thanks

James
-----Original Message-----
Are Title, CD, tblCds columns in the table [tblCD's]? At
its simplest, the structure of a UNION query is
SELECT colA, colB etc FROM TableA
UNION
SELECT colD, colE etc FROM TableB
etc
The two main rules are that the number of columns selected
in each part of the union must be the same and that the
datatypes of the respective columns must be the same i.e.
in the above example the datattype of colA must be the same
for colD and the datatype for coleB must be the same for colE

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have the following SQL QUERY:

--------------------------------------------------------
-
--

Select Title, CD as MediaType, tblCDs as BaseTable from
[tblCD's]
UNION
Select Title, [DVD Title] as MediaType, [tblDVD's] as
BaseTable from [tblDVD's]
UNION
Select Title, VCD as MediaType, tblVCDs as BaseTable from
[tblVCD's]
UNION
Select Title, Software as MediaType, tblSoftware as
BaseTable from tblSoftware
UNION
Select Title, MP3Title as MediaType, tblMP3Title as
BaseTable from tblMP3Title
UNION
Select Title, [MP3's on CD] as MediaType, tblMP3List as
BaseTable from tblMP3List;

--------------------------------------------------------
-
--

It keeps prompting me for Title,CD,tblCD's and other
random things...

All I want is a simple UNION query... I have had help with
this one from people in these newsgroups....

What could be thr problem?

all I want it a UNION query to unite all my tables
together so that I can search it as I am creating a search
form...

Many Thanks

James
.

.
.
.
 
Ok so how do I go about fixing this issue then???

How would I need to modify my code so that everything
works?

Many Thanks

James
-----Original Message-----
It is the punctuation in the table names that is causing
the problems.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Ok... I have tried your UNION query at its simplist...
here it is and it tells me that its invalid braceting??

--------------------------------------------------------- --

SELECT
[CD Album Title],
Null
From tblCD's;
UNION SELECT
[DVD Title],
Null
FROM tblDVD's;
UNION SELECT
MP3Title,
Null
FROM tblMP3Title;
UNION SELECT
[MP3's On CD],
Null
FROM tblMP3List;
UNION SELECT
[Software Title],
[Type of Software]
FROM tblSoftware;
UNION SELECT
[VCD Title],
Null
FROM tblVCD's;

--------------------------------------------------------- --

What brackets do I need I have tried the following:

{} [] () "" ''

What do I have to do to make this thing work?

Many Thanks

James :)
-----Original Message-----
No there not.. tblCDs is the table name...

CD is just nothing...

Title I would refer that to being CD Title....

But I will try what you have suggested and see how it
goes...

Many Thanks

James

-----Original Message-----
Are Title, CD, tblCds columns in the table [tblCD's]? At
its simplest, the structure of a UNION query is
SELECT colA, colB etc FROM TableA
UNION
SELECT colD, colE etc FROM TableB
etc
The two main rules are that the number of columns selected
in each part of the union must be the same and that the
datatypes of the respective columns must be the same i.e.
in the above example the datattype of colA must be the
same
for colD and the datatype for coleB must be the same for
colE

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have the following SQL QUERY:

------------------------------------------------------
--
-
--

Select Title, CD as MediaType, tblCDs as BaseTable from
[tblCD's]
UNION
Select Title, [DVD Title] as MediaType, [tblDVD's] as
BaseTable from [tblDVD's]
UNION
Select Title, VCD as MediaType, tblVCDs as BaseTable
from
[tblVCD's]
UNION
Select Title, Software as MediaType, tblSoftware as
BaseTable from tblSoftware
UNION
Select Title, MP3Title as MediaType, tblMP3Title as
BaseTable from tblMP3Title
UNION
Select Title, [MP3's on CD] as MediaType, tblMP3List as
BaseTable from tblMP3List;

------------------------------------------------------
--
-
--

It keeps prompting me for Title,CD,tblCD's and other
random things...

All I want is a simple UNION query... I have had help
with
this one from people in these newsgroups....

What could be thr problem?

all I want it a UNION query to unite all my tables
together so that I can search it as I am creating a
search
form...

Many Thanks

James
.

.

.
.
.
 
Ok so how do I go about fixing this issue then???

How would I need to modify my code so that everything
works?

Many Thanks

James
-----Original Message-----
It is the punctuation in the table names that is causing
the problems.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Ok... I have tried your UNION query at its simplist...
here it is and it tells me that its invalid braceting??

--------------------------------------------------------- --

SELECT
[CD Album Title],
Null
From tblCD's;
UNION SELECT
[DVD Title],
Null
FROM tblDVD's;
UNION SELECT
MP3Title,
Null
FROM tblMP3Title;
UNION SELECT
[MP3's On CD],
Null
FROM tblMP3List;
UNION SELECT
[Software Title],
[Type of Software]
FROM tblSoftware;
UNION SELECT
[VCD Title],
Null
FROM tblVCD's;

--------------------------------------------------------- --

What brackets do I need I have tried the following:

{} [] () "" ''

What do I have to do to make this thing work?

Many Thanks

James :)
-----Original Message-----
No there not.. tblCDs is the table name...

CD is just nothing...

Title I would refer that to being CD Title....

But I will try what you have suggested and see how it
goes...

Many Thanks

James

-----Original Message-----
Are Title, CD, tblCds columns in the table [tblCD's]? At
its simplest, the structure of a UNION query is
SELECT colA, colB etc FROM TableA
UNION
SELECT colD, colE etc FROM TableB
etc
The two main rules are that the number of columns selected
in each part of the union must be the same and that the
datatypes of the respective columns must be the same i.e.
in the above example the datattype of colA must be the
same
for colD and the datatype for coleB must be the same for
colE

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have the following SQL QUERY:

------------------------------------------------------
--
-
--

Select Title, CD as MediaType, tblCDs as BaseTable from
[tblCD's]
UNION
Select Title, [DVD Title] as MediaType, [tblDVD's] as
BaseTable from [tblDVD's]
UNION
Select Title, VCD as MediaType, tblVCDs as BaseTable
from
[tblVCD's]
UNION
Select Title, Software as MediaType, tblSoftware as
BaseTable from tblSoftware
UNION
Select Title, MP3Title as MediaType, tblMP3Title as
BaseTable from tblMP3Title
UNION
Select Title, [MP3's on CD] as MediaType, tblMP3List as
BaseTable from tblMP3List;

------------------------------------------------------
--
-
--

It keeps prompting me for Title,CD,tblCD's and other
random things...

All I want is a simple UNION query... I have had help
with
this one from people in these newsgroups....

What could be thr problem?

all I want it a UNION query to unite all my tables
together so that I can search it as I am creating a
search
form...

Many Thanks

James
.

.

.
.
.
 
Hello I have changed my code again so it now looks like
this:

It runs... the thing is that it pulls up a list of CD's
rather than in ColA its CD's in Col B its something
else... But there is no col C,D,E,F,G, etc....

I want it to be something like the following:

CD's DVD's Software MP3 Title MP3's on the CD VCD's

So that I can search it with my search form.

Many Thanks

James
-----Original Message-----
Ok so how do I go about fixing this issue then???

How would I need to modify my code so that everything
works?

Many Thanks

James
-----Original Message-----
It is the punctuation in the table names that is causing
the problems.

Hope This Helps
Gerald Stanley MCSD
-
--
SELECT
[CD Album Title],
Null
From tblCD's;
UNION SELECT
[DVD Title],
Null
FROM tblDVD's;
UNION SELECT
MP3Title,
Null
FROM tblMP3Title;
UNION SELECT
[MP3's On CD],
Null
FROM tblMP3List;
UNION SELECT
[Software Title],
[Type of Software]
FROM tblSoftware;
UNION SELECT
[VCD Title],
Null
FROM tblVCD's;

--------------------------------------------------------
-
--
What brackets do I need I have tried the following:

{} [] () "" ''

What do I have to do to make this thing work?

Many Thanks

James :)
-----Original Message-----
No there not.. tblCDs is the table name...

CD is just nothing...

Title I would refer that to being CD Title....

But I will try what you have suggested and see how it
goes...

Many Thanks

James

-----Original Message-----
Are Title, CD, tblCds columns in the table
[tblCD's]?
-
--
-
--

Select Title, CD as MediaType, tblCDs as BaseTable from
[tblCD's]
UNION
Select Title, [DVD Title] as MediaType, [tblDVD's] as
BaseTable from [tblDVD's]
UNION
Select Title, VCD as MediaType, tblVCDs as BaseTable
from
[tblVCD's]
UNION
Select Title, Software as MediaType, tblSoftware as
BaseTable from tblSoftware
UNION
Select Title, MP3Title as MediaType, tblMP3Title as
BaseTable from tblMP3Title
UNION
Select Title, [MP3's on CD] as MediaType, tblMP3List as
BaseTable from tblMP3List;

-----------------------------------------------------
-.
 
Hello I would like to explain my last post a little more
clear...

Basically I have one Column when the query runs... It has
everything in this column from CD'S, DVD' VCD's
everything....

And another column with EXPR001 and I cant seem to get it
to split them up so that it has all the diffrent formats
in diffrent colums....

Then I can search by it...

How do I achieve this?

Many Thanks

James
-----Original Message-----
Hello I have changed my code again so it now looks like
this:

It runs... the thing is that it pulls up a list of CD's
rather than in ColA its CD's in Col B its something
else... But there is no col C,D,E,F,G, etc....

I want it to be something like the following:

CD's DVD's Software MP3 Title MP3's on the CD VCD's

So that I can search it with my search form.

Many Thanks

James
-----Original Message-----
Ok so how do I go about fixing this issue then???

How would I need to modify my code so that everything
works?

Many Thanks

James
-
-
--

SELECT
[CD Album Title],
Null
From tblCD's;
UNION SELECT
[DVD Title],
Null
FROM tblDVD's;
UNION SELECT
MP3Title,
Null
FROM tblMP3Title;
UNION SELECT
[MP3's On CD],
Null
FROM tblMP3List;
UNION SELECT
[Software Title],
[Type of Software]
FROM tblSoftware;
UNION SELECT
[VCD Title],
Null
FROM tblVCD's;

-------------------------------------------------------
-
-
--

What brackets do I need I have tried the following:

{} [] () "" ''

What do I have to do to make this thing work?

Many Thanks

James :)
-----Original Message-----
No there not.. tblCDs is the table name...

CD is just nothing...

Title I would refer that to being CD Title....

But I will try what you have suggested and see how it
goes...

Many Thanks

James

-----Original Message-----
Are Title, CD, tblCds columns in the table
[tblCD's]?
At
its simplest, the structure of a UNION query is
SELECT colA, colB etc FROM TableA
UNION
SELECT colD, colE etc FROM TableB
etc
The two main rules are that the number of columns
selected
in each part of the union must be the same and that the
datatypes of the respective columns must be the same i.e.
in the above example the datattype of colA must be the
same
for colD and the datatype for coleB must be the same for
colE

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have the following SQL QUERY:

----------------------------------------------------
-
-
--
-
--

Select Title, CD as MediaType, tblCDs as BaseTable from
[tblCD's]
UNION
Select Title, [DVD Title] as MediaType, [tblDVD's] as
BaseTable from [tblDVD's]
UNION
Select Title, VCD as MediaType, tblVCDs as BaseTable
from
[tblVCD's]
UNION
Select Title, Software as MediaType, tblSoftware as
BaseTable from tblSoftware
UNION
Select Title, MP3Title as MediaType, tblMP3Title as
BaseTable from tblMP3Title
UNION
Select Title, [MP3's on CD] as MediaType,
tblMP3List
as
BaseTable from tblMP3List;

----------------------------------------------------
-
.
 
Back
Top