My Assistant
![]() ![]() |
|
|
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!!! |
|
|
|
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 |
|
|
|
Mar 8 2012, 12:44 PM
Post
#3
|
|
|
Access Wiki and Forums Moderator Posts: 47,943 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 |
|
|
|
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. |
|
|
|
Mar 8 2012, 12:47 PM
Post
#5
|
|
|
UtterAccess Editor Posts: 4,785 From: Omaha, NE USA |
|
|
|
|
Mar 8 2012, 12:51 PM
Post
#6
|
|
|
Access Wiki and Forums Moderator Posts: 47,943 From: SoCal, USA |
Going on my monitor: "Take a break, Cynthia's got the ball." (IMG:style_emoticons/default/coffee1.gif) |
|
|
|
Mar 8 2012, 12:54 PM
Post
#7
|
|
|
UtterAccess Editor Posts: 4,785 From: Omaha, NE USA |
|
|
|
|
Mar 8 2012, 12:58 PM
Post
#8
|
|
|
UtterAccess Enthusiast Posts: 54 |
Thank you everyone!!!
I will give it a try Lynn |
|
|
|
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 Top · Lo-Fi Version | Time is now: 21st May 2013 - 10:06 AM |