Hard-coded date in an Access Form

M

millerwms

Good morning,

I have created a form for our field reps which they will be completing to
escalate an employee issue. One field I have in my bound table is "Date
Submitted". Instead of leaving this open and up to the rep to fill in (and
possibly back date!), I would like to hard-code for "today" to drop right
into that field within the form.

Could I create a macro to accomplish this? Any help or suggestions on how
to are greatly appreciated.

Regards,
Scott
 
B

Beetle

No macro or code necessary. Set the default value to;

Date()

which will return the current date.
 
G

golfinray

Put a new field in your table called Last_updated. Then in the events
properties of the textbox where date is, go to the onclick event and add this
code:
Me.Last_updated=Now()
 
M

millerwms

Thank you Mr. Purdy,

You actually bring up a good point for me to add a separate field to capture
updated date, though I would still like to capture separately submit date.

Prior to seeing these responses, I found the answer on how to add default
dates.

I appreciate the quick responses!

Regards,
Scott
 
M

millerwms

Mr. Bailey,

I have set this up in my general properties, but on my form it is kicking
back a date of 12/30/1899. I thought this might be due to the dates within
my machine, but when I use the "today" radio button within the date picker,
the proper date populates.

Any suggestions?

Thanks in advance!
Scott
 
M

millerwms

I am having trouble locating events properties. Do you mean within field
properties? I am using date/time data type.

I am sure these are simple questions, and appreciate your feedback and
patience.

Scott
 
M

millerwms

Hello,

I was able to enter the code listed below in the events properties in my
form design view, but received the following message when confirming in form
view:

"The expression On Click you entered as the event property setting produced
the collowing error: The object doesn't contain the Automation object "Me.".

Any ideas?

Thanks Again,
Scott
 
B

Beetle

Let's take a step back here. Have you now decided to add another
field to your table to track every time the record is modified?

If so, the On Click event of the Date Submitted text box is the
WRONG event to be doing this in. You would want to use the
Before Update event of the form.

Also, I'm guessing that you're attemptimg to just put
that line directly in the properies of the control, which won't
work. You would need to open the code window and put it
there.

Why don't you post back and let us know exactly what it is that
you want to happen, and we can give you more advice.
 
T

tina

and, if you don't want the user to be able to change the value, set the
Locked property of the control to Yes.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top