I'm in the process of converting an Excel 'database' into an Access database.
I have two tables - DataFromExcel
and tbl_AuditResults
.
DataFromExcel
has these fields: AutoNum
(PK),1
,1 Comment
,2
, 2 Comment
,.... 19
,19 Comment
tbl_AuditResults
has these fields: ID
(PK), Param
(PK), Result
(Boolean), Notes
DataFromExcel
has 19 fields for each ID (and related Comment field),
tbl_AuditResults
has 19 records for each ID and a Notes
field.
I'm looking to update the Result
& Notes
fields to show TRUE and the comment if the relevant DataFromExcel field contains the number 1.
I have this SQL which works on a field by field basis, but I have to update it for each field (the example is for field 4
).
UPDATE tbl_AuditResults INNER JOIN DataFromExcel ON tbl_AuditResults.ID = DataFromExcel.AutoNum
SET Result = TRUE, Notes = [4 Comment]
WHERE DataFromExcel.[4] = 1 AND tbl_AuditResults.Param = 4
Does anyone know how I could do it all in one pass?