Hi Karl,
I did the following SQL statement for all the buildings and when I hit RUN
it says Enter Parameter Value 105:
SELECT 105 AS Building, CLIN, Category, Description, PartNo, Manufacturer,
UOMID, [Building 105] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 114 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 114] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 216 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 216] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 611 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 611] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 620 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 620] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 708 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 708] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 712 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 712] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1048 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1048] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1102 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1102] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1109 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1109] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1122 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1122] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1130 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1130] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1200 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1200] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1205 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1205] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1206 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1206] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1422 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1422] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1510 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1510] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1511 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1511] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1517 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1517] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1518 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1518] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1604 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1604] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1606 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1606] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1610 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1610] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1614 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1614] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1627 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1627] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1628 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1628] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1629 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1629] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1720 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1720] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1816 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1816] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1817 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1817] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
UNION SELECT 1918 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 1918] AS Quantity
FROM [Shaw LOM- Unrestricted- v1]
I went to Query Design, Closed the Show Table Box, Union, then pasted the
above statement into SQL View Tab, RUN.
Just to restate, all the data imported from Excel went into one table not
multiple tables.
Where is my mistake?
Reading my first post, I previously stated without stating the question:
For an example, Building 105 would have the six columns above, a seventh
column, Quantity; it would have only 57 rows of the parts that are ordered
for this building instead of all 326 possible parts.
Here it is- How do I get a report not to list a row (for a part that is not
used) where the quantity field is blank and just list the 57 out of 326 rows
that contain an ordered part?
Thanks for your help again,
Phil Elmers
P.S. Your COUNTNUMBER statement last week for labels works great and will
save many man-hours!!!
KARL DEWEY said:
uSE A UNION QUERY LIKE THIS ---
SELECT 105 AS Building, CLIN, Category, Description, PartNo, Manufacturer,
UOMID, [Building 105] AS Quqnity
FROM [YourTableName]
UNION SELECT 115 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 115] AS Quqnity
FROM [YourTableName]
............
UNION SELECT 245 AS Building, CLIN, Category, Description, PartNo,
Manufacturer, UOMID, [Building 245] AS Quqnity
FROM [YourTableName];
--
KARL DEWEY
Build a little - Test a little
2GWLAN said:
I have an Excel 2007 spreadsheet that is a List of Materials. The first row
consists of headings followed by building numbers. This is a bad start to
export to Access. Ultimately, I just have a onetime conversion to generate a
parts list by building. Doing this in Excel is slow to cut and paste as well
as removing the rows that do not have a part ordered. For this particular
job, there are 326 rows of various parts with the following headings-
CLIN Category Description PartNo Manufacturer UOMID
These six columns are followed by 31 building numbers with the number of
that part that needs to be purchased for a total of 37 columns. What is the
best way to pare this down into a report sorted by building number and
renaming the column that is currently headed by building number as Quantity?
For an example, Building 105 would have the six columns above, a seventh
column, Quantity; it would have only 57 rows of the parts that are ordered
for this building instead of all 326 possible parts.
I am a novice with Access, can easily import, and understand the basics of
queries and reports.