-----Original Message-----
The form has four fields from a table:"ADS(names of
donation stations are stored)", "Date (Medium date
format)", "Time (short time format)", and "Qty (Quantity
for number of donors per date time period)"
The control name is "Date" and it is Date/Time data type.
Here is code I typed in as I understood your instructions:
Option Compare Database
Private Sub Form_AfterUpdate()
With Me![Date]
.DefaultValue = Format(.Value, "\#mm/dd/yyyy\#")
End With
End Sub
Private Sub Date_BeforeUpdate(Cancel As Integer)
End Sub
I appreciate your willingness to try to help
That looks to me as though it ought to work, at least to do what I
thought was wanted, so long as the property sheet for the form specifies
"[Event Procedure]" on the Before Update line on the Event tab. The
empty Date_BeforeUpdate procedure isn't doing anything (unless you just
failed to copy the code), and should be deleted.
What this code should do, and does for me, is capture the date I just
entered in the control and set that as the control's default value for
the next record. Is it not doing that for you? The code will not set a
default value until the first time you save a record in the current
editing session with the form -- if you want it to set a default value
when the form is first opened, more code must be written. Also, the
code is not intended to pick up the most recent date ever entered in the
table; it's just supposed to pick up what you enter, each time you
enter something, and make that the default value for the next record.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.