Updating Table Record Using VB

accnewbie

New Member
Joined
Dec 21, 2003
Messages
2
I'm creating a small payroll program. Currently I have the following tables (among others):
Employee Data - Employee Name, Number, Address, etc.
Employee Hours - Employee Number, Work Date, Hours, [Filing Status (to be filled in using VB code from Employee Tax Status table]
Employee Tax Status - Employee Number, Valid As Of Date, Filing Status

After the user inputs data in the three fields of the Employee Hours file, I want to execute some VB code to figure out which Filing Status should be added to the record.

I'm new to this and have bought some MS Access & VB manuals. I'm looking for help in how to create the code to check for the latest validity date in the Employee Tax Status table for the Employee Number, pick up the associated Filing Status, and put it in the Employee Hours field. Any help on the code would be appreciated.

Thanks,
Ed
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Why store the same value in two tables? If the value is in another table, just use a query to pull the two things together.
 
Upvote 0
The filing status has a validity date and doesn't have an exact match to the date worked. For example an employee may have had an original filing status of single effective 01/01/03 and changed it to married on 06/30/03. For work performed 12/01/03 I want to pick up the status with the latest validity date (06/30/03) and add this to the hours worked table (not hours worked field as mentioned in my original message).

If you can show me how a query can do this instead of VB that would be great as well.

Thanks,
Ed
 
Upvote 0

Forum statistics

Threads
1,221,596
Messages
6,160,716
Members
451,665
Latest member
PierreF

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