Enter date after use of tab (1 Viewer)

access2010

Registered User.
Local time
Yesterday, 22:43
Joined
Dec 26, 2009
Messages
517
Can I please have a suggestion on how to have
=To-Days date= placed into the =Target_Date= field after the =Target_$= has been manually entered and the tab moves to the =Target_Date= field

Thank you,
Nicole
 

Attachments

theDBguy

I’m here to help
Local time
Yesterday, 22:43
Joined
Oct 29, 2018
Messages
10,099
Hi Nicole. For example, in the AfterUpdate event of the Targe_$ control, you could try something like:
Code:
Me.TargetDate=Date()
Hope it helps...
 

arnelgp

error reading drive A:
Local time
Today, 13:43
Joined
May 7, 2009
Messages
9,292
also possible on Target_$, BeforeUpdate() event.
 

access2010

Registered User.
Local time
Yesterday, 22:43
Joined
Dec 26, 2009
Messages
517
Thank you for your suggestions, which I have tried without success.

Your code is entered as
Me.TargetDate=Date()

and then it is automatically changed to
Me.TargetDate = Date
Note space before and after =

Could you please let me know, what I have done wrong?

Thank you,
Nicole
 

theDBguy

I’m here to help
Local time
Yesterday, 22:43
Joined
Oct 29, 2018
Messages
10,099
Thank you for your suggestions, which I have tried without success.

Your code is entered as
Me.TargetDate=Date()

and then it is automatically changed to
Me.TargetDate = Date
Note space before and after =

Could you please let me know, what I have done wrong?

Thank you,
Nicole
Hi Nicole. How exactly did you enter the code and what exactly happened? Did you go to the AfterUpdate event of the control and then selected [Event Procedure] from the dropdown and then clicked the ellipsis next to it and then entered the code inside the code stub?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:43
Joined
Feb 19, 2002
Messages
28,755
Are you saying that TargetDate didn't get populated or you are confused because Access changed your code.

Access' "correction" is correct.

Me.TargetDate = Date ---- is correct.
 

access2010

Registered User.
Local time
Yesterday, 22:43
Joined
Dec 26, 2009
Messages
517
Thank you, Pat.
I now now why the information in the code changed.

===
I have tried the update in the price field and date fields, using theDBguy's code and arnelgp code

In the = price field = after update
and in the = date field = before update

In both cases I receive this message
= Compile Error - Method or date member not found.

===
Crystal
 

arnelgp

error reading drive A:
Local time
Today, 13:43
Joined
May 7, 2009
Messages
9,292
on vba, Compile your code and you will see the error. fix it first.
 

access2010

Registered User.
Local time
Yesterday, 22:43
Joined
Dec 26, 2009
Messages
517
theDBguy
Pat Hartman
arnelgp

Thank you for your assistance of using the code = Me.TargetDate=Date()
BUT, I just realized the I should have used = Me.Target_Date=Date() = which was the fields name.

Nicole
 

theDBguy

I’m here to help
Local time
Yesterday, 22:43
Joined
Oct 29, 2018
Messages
10,099
theDBguy
Pat Hartman
arnelgp

Thank you for your assistance of using the code = Me.TargetDate=Date()
BUT, I just realized the I should have used = Me.Target_Date=Date() = which was the fields name.

Nicole
Hi Nicole. Congratulations! Glad to hear you got it to work. Good luck with your project.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:43
Joined
Feb 19, 2002
Messages
28,755
When you use "Me.", you should be getting intellisense to help you finish without typing. This gives you a clue that you are making a typo. Also, if you use CamelCase and type camelcase, when you finish the word, Access capitalizes the letters to match the name's definition which is another visual clue that you have created a typo.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom