Updating Table information using code

baadams

Board Regular
Joined
Mar 2, 2006
Messages
134
In this particular application I don't think an update query would be applicable.

I've got a database that tracks constraints to a particular job. There are many types of constraints. Some constraints are entered into the database manually. Some are entered programmatically using macros. The ones entered automatically come from a different system via daily .CSV dumps. Once they enter the tracking database they are given status, OPR (organization of primary responsibility), ECD (estimated complete date) or they are closed. The above fields are assigned, only the OPR comes from the .CSV download.

Here's my question. How do I update the OPR in the database based on what is in the daily file? Each day the .CSV file is updated. The database only tracks open constraints and the .CSV file has all constraints open, closed and void. Right now we view each constraint and re-assign the OPR manually after the file is updated.

Here's the catch. If the OPR has changed I have to clear the ECD. The ECD that exists was the ECD for that organization and doesn't apply to the organization it's currently assinged to. Also if the OPR is "CL" meaning it's been closed I need to assign the field [Closed] to the value in the .CSV. The .CSV file has a field [Closed Date] so this seems pretty straight forward. I could easily assign the closed date with an update query. But If I figure out how to update the ECD and OPR, I'm sure the date assignment would be simple.

I don't know how to udated the OPR and clear the ECD. I might have 50 open constraints and there will be 8 constraints re-assinged to a new OPR, these are the ones I want to update and clear the old ECD.

My current thoughts are that I need two recordsets, these recordsets will compare the constraint ID (unique to each constraint) in the constraint table and the .CSV download, if the OPR is different between each file, assign the OPR in the constraint table the value that exists in the .CSV (which is linked to the database) and clear the ECD in the constraint table. Also check if the OPR = "CL", if so, tbl_constraints.[Closed] = CSV.[Closed Date]

I hope this makes sense? It's clear in my head, but I'm at a loss in the execution. Thanks for the help. Sorry it took so long to describe
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,224,586
Messages
6,179,726
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top