Field1 Copy to Field 2 (Date)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I have a form that temporarily copies its value to a second field on a form
until it is later changed. The following code is place in the AfterUpdate of
Field1.

Me.field2.value = me.field1.value


This works perfectly, both the above are number fields. I then wish to do
the same with two date fields on the same form. Except it doesn't seem to
work any ideas? Any and all help welcome. Thanks for taking the time to
read this.

Debbie D.
 
Hi, Debbie.
This works perfectly, both the above are number fields. I then wish to do
the same with two date fields on the same form. Except it doesn't seem to
work any ideas?

Is field2 a control bound to a Date field? If not, this won't work. It
will only save a text value of the copied date. However, later when this
value is copied elsewhere, you may use the date conversion function, CDate(
). Try:

Me!MyDate.Value = CDate(Me!field2.Value)

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
Thanks 69 Camaro,

Both fields are date and bound to the query through a control source. Tried
your example but nothing yet. Thanks though.. if you have any other ideas...
Thanks.
 
Ofer,

No error messages at all, just the dates goes onto the first field and no
update of second. Both fields are of the type date and are bound through the
control source. Only one table involved in the query. Here is the exact
code I am putting into the AfterUpdate Sub

me.ecdllevel2.value = ecdllevel1.value

Any ideas welcome. Debbie (yet again!!) Thanks.
 
I have checked the code, and it seem to work
I would try and check if the name are correct, but you probably allready did

Try typing
me.ecdllevel2 = me.ecdllevel1

Check if after the me it display the name of the field.

I would check one more thing, it could be that you copy and paste the code,
but this code is actually not connected to the properties of the ecdllevel1
field, open the form in design view, and check the after update event of the
field, and see if you actually inserted the call there.
Its not enough to copy and paste the code, you need to specify in the
properties, that actually want to call the code
 
Ofer,

Me.ECDLLevel2Reg = Me.ECDLLevel1Reg

Now works thanks to you, but it only work onExit and not AfterUpdate. Hey
ho it works though. Thanks for all the assistance that you have given me.
I'm on with the Switchboard now and it should be finished within the next
24hrs. I'm going to miss you however, I'm still going to carry on with
Access. Thanks again :-)
 
Back
Top