Update MS access db using Excel files

Henk S

New Member
Joined
Dec 30, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I defined an MS access data called stock. In this Data base are the fields A thru L.
I populated this data base with records containg voucher, each with a unique key (field A).

I have defined an excel files containing all sales, as far as we know, containing the fields A, B, C, H and I.
The registration was never done, so I will find sales where no stock was defined.
In case field A matches I need to update the fields H and I in the data base.
In case field A is not matched I need to create a database record to define the stock record with field A, B and C, where the fields D and E contains the values 1400 and 1450, and of course the field values of H and I.

Who can help me out finding the right codings?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
First, I'll tell you that your db is not normalized and that you should stop, research db normalization and then apply those principles.
I doubt you will start over, so for point 1, consider a query that matches (what I don't know and don't see that clarified). Then run an update query on that query, updating the necessary fields to your desired values. For point 2, you could try the Unmatched Query wizard to find records that don't match and do the same but using that query as the basis from which to work from.

There are factors involved which can prevent you from being able to update either of those queries, one of them being that the tables aren't normalized. I would test the input queries before going further with them. When run, if they return the records you want but you can't edit anything as a test, then it/they are unsuitable.
 
Upvote 0

Forum statistics

Threads
1,212,927
Messages
6,110,695
Members
448,293
Latest member
jin kazuya

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