mardi 21 juin 2016

Modify and add new records to an Access database

We have a MS Access 2016 database. We queried the DB to find some parts in inventory. The first few rows of the query results are below. We have a primary key called DBID with a unique number for all of our records in the original table.

ORIGINAL QUERY:

SELECT [Slash Series Query].BRAND, [Slash Series Query].[PRODUCT ID], [Slash Series Query].[STOCK QUANTITY] FROM [Slash Series Query] WHERE ((([Slash Series Query].[PRODUCT ID]) Not Like "k"));

RESULTS:

Slash Straight Bore Query

BRAND PRODUCT ID
FAG 230/500 BMB H14C W33
SKF 230/500 CA C08 W509
ZKL 230/500 MW33
KOY 230/500 RW513 SOFY
KOY 230/500R W33 C3 FY
FAG 230/530 MBR50150H78CW209C
FAG 230/530 C3 H40AC
NSK 230/530CAM E4 C3 S11
FAG 230/600 BM C3 W33 T52BW
FAG 230/600 C08W503
SKF 230/600 CA C08 W509
FAG 239/530 MBH40.T52BW
FAG 239/530MB
SKF 248/530 CAMA/C3/W20
TOR 249/850 W33 W45 CW57 C2

We would like to insert a solution that adds a new record to the database with a “K” in the part number and also adds a “_(MOD)” to the end of the part number, in addition to the existing part number, so it would look like this:

(Brand = 3 letter manufacturer code, Product ID = part number)

Slash Tapered Bore Query

BRAND PRODUCT ID
FAG 230/500 K BMB H14C W33 (MOD)
SKF 230/500 K CA C08 W509 (MOD)
ZKL 230/500 K MW33 (MOD)
KOY 230/500 K RW513 SOFY (MOD)
KOY 230/500 K R W33 C3 FY (MOD)
FAG 230/530 K MBR50150H78CW209C (MOD)
FAG 230/530 K C3 H40AC (MOD)
NSK 230/530 K CAM E4 C3 S11 (MOD)
FAG 230/600 K BM C3 W33 T52BW (MOD)
FAG 230/600 K C08W503 (MOD)
SKF 230/600 K CA C08 W509 (MOD)
FAG 239/530 K MBH40.T52BW (MOD)
FAG 239/530 K MB (MOD)
SKF 248/530 K CAMA/C3/W20 (MOD)
TOR 249/850 K W33 W45 CW57 C2 (MOD)

What would be the most efficient way to accomplish this?

Aucun commentaire:

Enregistrer un commentaire