2 questions

  • Thread starter Thread starter Jennifer
  • Start date Start date
J

Jennifer

1st Question: I have a date field. I want the date to
automatically populate with the previous record's date
until I change it. How can this be done?

2nd Question: I have the following fields:
ShipTo
ShipToAddress
ShipToCityState
Envelopes?
EnvAddress
EnvCityState

If the ShipTo field is "Home Address" and the Envelopes?
field is "Yes", I want the ShipToAddress and
ShipToCityState to automatically populate into the
EnvAddress and EnvCityState fields. Is there a way this
can be done?

Thank you so much!!
 
1. The easiest way to copy the date is just use Ctrl + ". This copies the
previous entry to the current entry. Writing code to do this may not be
worth the hassle.

2. Write an If statement against the ShipTo field's AfterUpdate event.
Air Code and subject to modification

If ShipTo = "Home Address" AND Envelopes = "Yes" then
EnvAddress=ShipToAddress
EnvCityState = ShipToCityState
Else
EnvAddress = ""
EnvCityState = ""
End If
 
Hi Jennifer -

This is Steven from Microsoft Access Technical Support replying to your
newsgroup post.

I hate to make assumptions, but in this case, I will assume you are working
within an Access form.

If you have a textbox on the form that is bound to your Date/Time field,
you can go to the DefaultValue property of that textbox, and enter an
expression similar to the following:

=DLast("[Name_of_Date/Time_Field]",
"Name_of_Table_that_Stores_Date/Time_Field")

This expression will execute every time you go to a new record on the form.
This expression will always retrieve the last date/time stored in the
Date/Time field of your table. That will be the date stored when you save
the new record, unless you manually enter that textbox, and change the
value that was retrieved to some other date value. Regardless, whatever
date is in the textbox at the time you save the record, will be that value
saved.

Please let me know if this solves your problem or if you would like further
assistance. I look forward to hearing from you.

Sincerely,
Steven Parsons [MSFT]
Microsoft Access Product Support Services
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! (http://www.microsoft.com/security)
 
Back
Top