I got this message "Microsoft Office Access can't find the macro "Me!Date."
when I typed this in the after update box:
Me![Date].DefaultValue = "#" & Me![Date] &"#"
What did I do wrong? The field name is DATE.
I feel like an idiot.
:
On Mon, 1 Oct 2007 12:59:02 -0700, Pat wrote:
How can I get a date or any field to stay the same in a form until I change
it. I need to post a lot records under same date. It would save untold time
if I could not have to re-enter the date each time.
Thanks for any help.
If the field is NOT a Date datatype code that control's AfterUpdate
event:
Me![ControlName].DefaultValue = """" & Me![ControlName] & """"
If the field IS a Date datatype, then code that control's AfterUpdate
event:
Me![DateField].DefaultValue = "#" & Me![DateField] & "#"
You'll have to enter the value just once per session.
It will remain the same until changed.
What do you mean by "when I typed this in the after update box:"?
Did you type it on the line that says AfterUpdate?
That's not where it goes.
On the line that says AfterUpdate, write:
[Event Procedure]
Then click on the little button with 3 dots that appears on that line.
When the Code window opens, the cursor will be flashing between 2
already existing lines of code. Between those 2 lines, write:
Me![DateControlName].DefaultValue = "#" & Me![DateControlName] &"#"
Exit the code window.
See my other reply regarding using Date as a field name.