D
daksport00
Hello,
I am trying to come up with a piece of SQL code that will select
data from multiple tables.
The table names are [General Drawings] [Fabrication Drawings]
[Sketches].
All 3 tables are setup with the same field names: [Drawing Number]
[Drawing Name] [Job Number] [Serial Number] [Current Revision] [Date]
[Author] [Furnace Model] [Size].
I have a form that is being used to display drawings that relate
to a given Furnace Model. There is a subform that will give the
information for the drawings. I have a setup where you can select to
see the drawings list limited to just General Drawings, Fabrication
Drawings, Sketches, or see all drawings.
I can use this SQL code to work with the 3 limited lists:
******************
"SELECT [General Drawings].[Drawing Number], [General
Drawings].[Drawing Name], " & _
"[General Drawings].[Job Number], [General
Drawings].[Serial Number], " & _
"[General Drawings].[Current Revision], [General
Drawings].[Date], " & _
"[General Drawings].[Author], [General
Drawings].[Furnace Model], " & _
"[General Drawings].[Size] " & _
"FROM [General Drawings] " & _
"WHERE [General Drawings].[Furnace Model] Like '*" &
Me.cmbModelNumber & "*';"
******************
I was able to modify it to pull valus from all 3 tables by using
this code:
******************
"SELECT [Sketches].[Drawing Number], [Sketches].[Drawing Name], " & _
"[Sketches].[Job Number], [Sketches].[Serial Number], "
& _
"[Sketches].[Current Revision], [Sketches].[Date], " &
_
"[Sketches].[Author], [Sketches].[Furnace Model], " & _
"[Sketches].[Size], " & _
"[Fabrication Drawings].[Drawing Number], [Fabrication
Drawings].[Drawing Name], " & _
"[Fabrication Drawings].[Job Number], [Fabrication
Drawings].[Serial Number], " & _
"[Fabrication Drawings].[Current Revision],
[Fabrication Drawings].[Date], " & _
"[Fabrication Drawings].[Author], [Fabrication
Drawings].[Furnace Model], " & _
"[Fabrication Drawings].[Size], " & _
"[General Drawings].[Drawing Number], [General
Drawings].[Drawing Name], " & _
"[General Drawings].[Job Number], [General
Drawings].[Serial Number], " & _
"[General Drawings].[Current Revision], [General
Drawings].[Date], " & _
"[General Drawings].[Author], [General
Drawings].[Furnace Model], " & _
"[General Drawings].[Size] " & _
"FROM [Sketches], [Fabrication Drawings], [General
Drawings] " & _
"WHERE [General Drawings].[Furnace Model] Like '*" &
Me.cmbModelNumber & "*' AND " & _
"[Fabrication Drawings].[Furnace Model] Like '*" &
Me.cmbModelNumber & "*' AND " & _
"[Sketches].[Furnace Model] Like '*" &
Me.cmbModelNumber & "*'"
******************
The problem I am having is that I would like the valules to append
to each other, but I am reluctant to use a temporary table because this
will be a multi-user database and I am trying to stay away from temp
tables, because you can get into the wonderful world of runtime errors
caused by tables being opened by other users.
I know that using an Append Query, I need a table to append to,
hence a Temporary table. If I try to use an Update Query, it will
update the data itself, not update to a specific field name.
Thanks in advance
-Dave
I am trying to come up with a piece of SQL code that will select
data from multiple tables.
The table names are [General Drawings] [Fabrication Drawings]
[Sketches].
All 3 tables are setup with the same field names: [Drawing Number]
[Drawing Name] [Job Number] [Serial Number] [Current Revision] [Date]
[Author] [Furnace Model] [Size].
I have a form that is being used to display drawings that relate
to a given Furnace Model. There is a subform that will give the
information for the drawings. I have a setup where you can select to
see the drawings list limited to just General Drawings, Fabrication
Drawings, Sketches, or see all drawings.
I can use this SQL code to work with the 3 limited lists:
******************
"SELECT [General Drawings].[Drawing Number], [General
Drawings].[Drawing Name], " & _
"[General Drawings].[Job Number], [General
Drawings].[Serial Number], " & _
"[General Drawings].[Current Revision], [General
Drawings].[Date], " & _
"[General Drawings].[Author], [General
Drawings].[Furnace Model], " & _
"[General Drawings].[Size] " & _
"FROM [General Drawings] " & _
"WHERE [General Drawings].[Furnace Model] Like '*" &
Me.cmbModelNumber & "*';"
******************
I was able to modify it to pull valus from all 3 tables by using
this code:
******************
"SELECT [Sketches].[Drawing Number], [Sketches].[Drawing Name], " & _
"[Sketches].[Job Number], [Sketches].[Serial Number], "
& _
"[Sketches].[Current Revision], [Sketches].[Date], " &
_
"[Sketches].[Author], [Sketches].[Furnace Model], " & _
"[Sketches].[Size], " & _
"[Fabrication Drawings].[Drawing Number], [Fabrication
Drawings].[Drawing Name], " & _
"[Fabrication Drawings].[Job Number], [Fabrication
Drawings].[Serial Number], " & _
"[Fabrication Drawings].[Current Revision],
[Fabrication Drawings].[Date], " & _
"[Fabrication Drawings].[Author], [Fabrication
Drawings].[Furnace Model], " & _
"[Fabrication Drawings].[Size], " & _
"[General Drawings].[Drawing Number], [General
Drawings].[Drawing Name], " & _
"[General Drawings].[Job Number], [General
Drawings].[Serial Number], " & _
"[General Drawings].[Current Revision], [General
Drawings].[Date], " & _
"[General Drawings].[Author], [General
Drawings].[Furnace Model], " & _
"[General Drawings].[Size] " & _
"FROM [Sketches], [Fabrication Drawings], [General
Drawings] " & _
"WHERE [General Drawings].[Furnace Model] Like '*" &
Me.cmbModelNumber & "*' AND " & _
"[Fabrication Drawings].[Furnace Model] Like '*" &
Me.cmbModelNumber & "*' AND " & _
"[Sketches].[Furnace Model] Like '*" &
Me.cmbModelNumber & "*'"
******************
The problem I am having is that I would like the valules to append
to each other, but I am reluctant to use a temporary table because this
will be a multi-user database and I am trying to stay away from temp
tables, because you can get into the wonderful world of runtime errors
caused by tables being opened by other users.
I know that using an Append Query, I need a table to append to,
hence a Temporary table. If I try to use an Update Query, it will
update the data itself, not update to a specific field name.
Thanks in advance
-Dave