Copy Fields Contents Problem

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

I have a simple form with a field that is a date/time field. What I want to
be able to do is that when I enter a date in this field and go to a new
record, that the contents from the field are automatically copied into the
field in the new record. I have no problem in accomplishing this when I use
another field that is formated as text. But when I try to do this on the
date/time field it always returns a value of 12/30/1899.

I have the following code attached on the AfterUpdate event:

ProdDate.DefaultValue = ProdDate.Value

Can anyone help me with this?

Thanks,
T
 
I haven't tried it but try:
ProdDate.DefaultValue = "#" & Me.ProdDate.Value & "#"
 
You're very welcome. Thanks for posting back with your success.
Thank you very much. It works like a charm.

Terry'
I haven't tried it but try:
ProdDate.DefaultValue = "#" & Me.ProdDate.Value & "#"
[quoted text clipped - 16 lines]
 
Terry said:
I have a simple form with a field that is a date/time field. What I want to
be able to do is that when I enter a date in this field and go to a new
record, that the contents from the field are automatically copied into the
field in the new record. I have no problem in accomplishing this when I use
another field that is formated as text. But when I try to do this on the
date/time field it always returns a value of 12/30/1899.

I have the following code attached on the AfterUpdate event:

ProdDate.DefaultValue = ProdDate.Value

The defaultValue property is more complex than that. Your
line of code will work for numeric values, but for a text
value you need:
xxx.DefaultValue = """" & Me.xxx & """"
and while the above will also work for a date value if you
use US date settings in windows, to be safe for any windows
local or date format settings:
xxx.DefaultValue = Format(Me.xxx, "\#yyyy-m-d\#")
 
Back
Top