UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Data Entry In Field (in Form) Updates A Date In Different Field, Office 2007    
 
   
lynnmc26
post Mar 8 2012, 12:35 PM
Post #1

UtterAccess Enthusiast
Posts: 54



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!!!

Go to the top of the page
 
+
cpetermann
post Mar 8 2012, 12:42 PM
Post #2

UtterAccess Editor
Posts: 4,785
From: Omaha, NE USA



lynnmc26,

What is your first name? (IMG:style_emoticons/default/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
Go to the top of the page
 
+
theDBguy
post Mar 8 2012, 12:44 PM
Post #3

Access Wiki and Forums Moderator
Posts: 47,962
From: SoCal, USA



Hi,

I think you pretty much got it. For example:

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

Just my 2 cents... (IMG:style_emoticons/default/2cents.gif)

EDIT: Oops, didn't see Cynthia's post earlier. Sorry for the duplicate info.

This post has been edited by theDBguy: Mar 8 2012, 12:45 PM
Go to the top of the page
 
+
Jerry Whittle
post Mar 8 2012, 12:46 PM
Post #4

Utter Access VIP
Posts: 1,003



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.
Go to the top of the page
 
+
cpetermann
post Mar 8 2012, 12:47 PM
Post #5

UtterAccess Editor
Posts: 4,785
From: Omaha, NE USA



DB,

Going on my 'frig-- "typed faster than DB today!" (IMG:style_emoticons/default/wink.gif)
Go to the top of the page
 
+
theDBguy
post Mar 8 2012, 12:51 PM
Post #6

Access Wiki and Forums Moderator
Posts: 47,962
From: SoCal, USA



QUOTE (cpetermann @ Mar 8 2012, 10:47 AM) *
DB,

Going on my 'frig-- "typed faster than DB today!" (IMG:style_emoticons/default/wink.gif)

Going on my monitor: "Take a break, Cynthia's got the ball." (IMG:style_emoticons/default/coffee1.gif)
Go to the top of the page
 
+
cpetermann
post Mar 8 2012, 12:54 PM
Post #7

UtterAccess Editor
Posts: 4,785
From: Omaha, NE USA



(IMG:style_emoticons/default/football.gif)
Go to the top of the page
 
+
lynnmc26
post Mar 8 2012, 12:58 PM
Post #8

UtterAccess Enthusiast
Posts: 54



Thank you everyone!!!

I will give it a try

Lynn
Go to the top of the page
 
+
cpetermann
post Mar 8 2012, 01:01 PM
Post #9

UtterAccess Editor
Posts: 4,785
From: Omaha, NE USA



DB & I were happy to help!

Good luck with your project!
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 02:42 AM