Enter date after use of tab (1 Viewer)

access2010

Registered User.
Local time
Today, 14:26
Joined
Dec 26, 2009
Messages
1,019
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

  • Date_After_Price.mdb
    484 KB · Views: 70

theDBguy

I’m here to help
Staff member
Local time
Today, 14:26
Joined
Oct 29, 2018
Messages
21,358
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

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:26
Joined
May 7, 2009
Messages
19,169
also possible on Target_$, BeforeUpdate() event.
 

access2010

Registered User.
Local time
Today, 14:26
Joined
Dec 26, 2009
Messages
1,019
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
Staff member
Local time
Today, 14:26
Joined
Oct 29, 2018
Messages
21,358
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, 17:26
Joined
Feb 19, 2002
Messages
42,976
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
Today, 14:26
Joined
Dec 26, 2009
Messages
1,019
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

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:26
Joined
May 7, 2009
Messages
19,169
on vba, Compile your code and you will see the error. fix it first.
 

access2010

Registered User.
Local time
Today, 14:26
Joined
Dec 26, 2009
Messages
1,019
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
Staff member
Local time
Today, 14:26
Joined
Oct 29, 2018
Messages
21,358
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, 17:26
Joined
Feb 19, 2002
Messages
42,976
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

Top Bottom