Add field for Last Modified Date

csenor

Board Regular
Joined
Apr 10, 2013
Messages
169
Office Version
  1. 365
Platform
  1. Windows
Good morning. I have a roster table that I had a "Record Modified" field. I had researched this before and made it work. I can't find my notes so I'm reaching out again. The field for some reason is not recording the date stamp any longer. I have the following VBA code in a module:

Option Compare Database


Private Sub Form_BeforeUpdate(Cancel As Integer)
[Record_Modified] = Date
End Sub

I have saved the VBA, reopened the form, entered data into a record, and it won't add the date stamp. Any suggestions?

I have tried the microsoft help center way of doing it with a macro and can't get that to work either.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Has VBA been enabled for that database at that particular workstation?
 
Upvote 0
Add this block of VBA code to your Form:
Code:
Private Sub Form_Load()
    MsgBox "Hello World!"
End Sub
Then save and close the Form.
Now try opening it again. When you do, do you get a message box? If you don't, then I suspect VBA has not been enabled.
 
Upvote 0
I added that code to VBA screen and it did appear when I opened the form. Is the code I listed above correct?
 
Upvote 0
Your code seems to work for me.
Is [Record_Modified] a bound field?
 
Upvote 0
I found the issue. I had attempted to create a macro from the advice of the other forums and microsoft help websites prior to the VBA. The macro was still listed in the Before Update section of the property sheet. When I deleted the macro from that spot, the dates started to work again. Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,221,792
Messages
6,161,995
Members
451,735
Latest member
Deasejm

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