Full Version: Data Entry In Field (in Form) Updates A Date In Different Field
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
lynnmc26
Hi all

I have two fields (data entry is at the form level) that need to work together.

In other words

BAFrom field - user enters data in this field and automatically populates the current date Date() into the field named BAFromUpdated

I am going to assume it would be an AfterUpdate code - just wondering the best code for that.

Thanks so much!!!

cpetermann
lynnmc26,

What is your first name? smile.gif

You can accomplish this several ways.

1. At table level you can set the DefaultValue for the field to: Date()
2. In Form Design View-- you can set the Default Value of the Control to: Date()
3. In the AfterUpdateEvent of BAFrom
Me.BAFromUpdated = Date()

HTH
theDBguy
Hi,

I think you pretty much got it. For example:

Private Sub BAFrom_AfterUpdate()
BAFromUpdated = Date()
End Sub

Just my 2 cents... 2cents.gif

EDIT: Oops, didn't see Cynthia's post earlier. Sorry for the duplicate info.
Jerry Whittle
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty = True Then
Me.BAFromUpdated = Now()
End If
End Sub

The above will update the BAFromUpdated field if ANYTHING has been changed in that record. You might want to consideer using Now instead of Date as Now gives the date and time.
cpetermann
DB,

Going on my 'frig-- "typed faster than DB today!" wink.gif
theDBguy
QUOTE (cpetermann @ Mar 8 2012, 10:47 AM) *
DB,

Going on my 'frig-- "typed faster than DB today!" wink.gif

Going on my monitor: "Take a break, Cynthia's got the ball." coffee1.gif
cpetermann
football.gif
lynnmc26
Thank you everyone!!!

I will give it a try

Lynn
cpetermann
DB & I were happy to help!

Good luck with your project!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.