Need Date field in a form to stay same until changed

G

Guest

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.
 
F

fredg

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.
 
G

Guest

Thanks a lot. I am new to this with an old mind and sometimes I do not know
how I could get it done without this group.
Thanks

fredg said:
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.
 
G

Guest

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.

fredg said:
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.
 
P

Pieter Wijnen

You should rename the Control As Access mixes it with the Date() function

HTH

Pieter

Pat said:
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.

fredg said:
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.
 
G

Guest

Do you mean rename the name of the field to something other than date?

Pieter Wijnen said:
You should rename the Control As Access mixes it with the Date() function

HTH

Pieter

Pat said:
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.

fredg said:
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.
 
F

fredg

Do you mean rename the name of the field to something other than date?

Pieter Wijnen said:
You should rename the Control As Access mixes it with the Date() function

HTH

Pieter

Pat said:
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.

Yes.
Date is a reserved Access/VBA/Jet word and should not be used as a
field name.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'

For an even more complete list of reserved words, see:
http://www.allenbrowne.com/AppIssueBadWord.html
 
F

fredg

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.

fredg said:
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.
 
G

Guest

I typed it in the block. I will change it.

fredg said:
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.

fredg said:
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.
 
G

Guest

When I changed it and changed the name of the Date field in the table it will
not let me put anything in the field on the form.

Sorry to be a pest.

Pat said:
I typed it in the block. I will change it.

fredg said:
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.
 
G

Guest

When I changed it and changed the name of the Date field in the table it will
not let me put anything in the field on the form.

Sorry to be a pest.

Pat said:
I typed it in the block. I will change it.

fredg said:
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.
 
P

Pieter Wijnen

Make Sure to Change the Underlying Query (if Any) & the ControlSource of The
Control as well
Also to make it work under other regional settings change the code to
(replace MyDate to actual ControlName)

Private Sub MyDate_AfterUpdate()
Me.MyDate.DefaultValue = Format(Me.MyDate.Value,"\#yyyy-mm-dd\#")
End Sub

HtH

Pieter

Pat said:
When I changed it and changed the name of the Date field in the table it
will
not let me put anything in the field on the form.

Sorry to be a pest.

Pat said:
I typed it in the block. I will change it.

fredg said:
On Mon, 1 Oct 2007 13:48:00 -0700, Pat wrote:

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.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


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.
 
G

Guest

I asked my Grandson to look at the statement and he says Grandma Pat you
forgot to close the Parentheses. Oh to be 16 again.

My thanks to all of you!!!

Pieter Wijnen said:
Make Sure to Change the Underlying Query (if Any) & the ControlSource of The
Control as well
Also to make it work under other regional settings change the code to
(replace MyDate to actual ControlName)

Private Sub MyDate_AfterUpdate()
Me.MyDate.DefaultValue = Format(Me.MyDate.Value,"\#yyyy-mm-dd\#")
End Sub

HtH

Pieter

Pat said:
When I changed it and changed the name of the Date field in the table it
will
not let me put anything in the field on the form.

Sorry to be a pest.

Pat said:
I typed it in the block. I will change it.

:

On Mon, 1 Oct 2007 13:48:00 -0700, Pat wrote:

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.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


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.
 

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