Macro to put today's date in a field

megatronixs

Registered User.
Local time
Today, 21:20
Joined
Aug 17, 2012
Messages
719
Hi all,

I'm new to access and was designing a nice form. Then I wanted to do something easy, that what I was thinking. What I need is a button that when pushed it will insert today's date in a field (the field is called Start Date).

I must be missing something as this I can't make it work. It must be so easy as it is in excel, but here in access I'm lost.

Can some one help with how the code should be.

Thanks in advance.
megatronixs
 
The On Click Event of the Buttom.

Me.[Start Date] = Date ()

End

Sing out if this does not work..

If further problems then post your Code. i.e. All the code in the procedure.
 
Hi Rain,

Thanks a lot. I was all morning looking in internet and nothing was there to find.
You saved me a lot of time on something so simple (if you know it)

Greetings,
megatronixs
 
Hi Rain,

May I ask one more question?
How to get the Login from PC in the field when I press the macro button. Maybe it is possible to combine both macros so that it will put the date and the login from the person using the PC.
I know that you can do it with: Environ("USERNAME") in excel. Is this the same for Access?

Thanks in advance,
megatronixs
 
A hint.

Your coding will be much easier if you use complete words.

StartDate rather than Start Date

In other words no spaces or special characters.
 
Finding the user name is more complicated.

Do a Google search as there are various options.

Choose the one that suits you best.

If you have problem don't hesitate to post back.

Personally I use a Function fosUserName. It however gives the Windows Log On. You may want something different.

BTW. You could use the event Before Update instead of the Command Button. This would automatically enter your DateStamp without using a Button.
 

Users who are viewing this thread

Back
Top Bottom