We receive daily json files via api that are then converted to csv file. Since I figured out how to use access vba to do find and replace in excel, the vba converts it to excel format in order to edit the header row (removing excess underscores or invalid chars in field name). Then use sql to append into an access table.
Every so often, the file contains an additional field and unfortunately, the vendor does not inform us of this (or if they do, I'm not on or aware of such a notification list), so when the vba runs the append query and a new field is added it generates an error. This affects all future data retrievals in that if we need to retrieve data from an earlier time period, it too will contain the new field(s).
I identified the issue by manually running the query, which produced the attached message informing me which field is missing. Does anyone know how I can trap for this and get the unknown (new) field name. I was thinking once I have that, I can use vba to modify the tabledef and append the new field name to the table so that the code can continue running without user intervention.
Code:
INSERT INTO SMDetailsMatrix SELECT T1.* FROM [Excel 12.0;HDR=YES;IMEX=1;Database=C:........
I identified the issue by manually running the query, which produced the attached message informing me which field is missing. Does anyone know how I can trap for this and get the unknown (new) field name. I was thinking once I have that, I can use vba to modify the tabledef and append the new field name to the table so that the code can continue running without user intervention.