vba - Excel to access

noidea23

New Member
Joined
Feb 16, 2022
Messages
28
Office Version
  1. 2021
Platform
  1. Windows
Hii, i need help in using macro to compare values in a column of an access table against a value in the excel spreadsheet. If the value matches then macro will do something to that particular row of access data.

E.g.

For each row in access_Table_X
If recordset.Fields(10).Value = Sheets("1").Range("A1").Value Then
cut and paste entire row of recordset in access_Table_X to recordset_Table_Y

Any help will be greatly appreciated!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You don't say which app you want to do this in or if table Y is in the same Access db. Personally I'd probably link the sheet to Access as a linked table then look for the value in the linked sheet. If found, run an Access query to copy from one table to the other (i.e. an append query). However, I'm not a fan of copying records into other tables and having the same data in two places. An exception would be if the source tables are linked (such as ODBC tables) that cannot be edited by the db user and need to be.

If you're going to do this from Excel instead, I guess you'll need to use Automation. Here's where I go if I need code for that:
 
Upvote 0
Thanks for your reply!
btw Table X and Y are different tables in the same Access
and the macro will be in Excel where Sheets("1").Range("A1").Value is in
 
Upvote 0

Forum statistics

Threads
1,224,297
Messages
6,177,743
Members
452,797
Latest member
prophet4see

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