Default Value

  • Thread starter Thread starter Floyd Forbes
  • Start date Start date
F

Floyd Forbes

Hi

I have a form in which one field is called date. The dates
entered are often the same for a period of time so I would like the
default value for this field to be the same as the last entered date.
Can anybody please help me with how to do this.

Thank you
 
On the form open event

me.datefieldname.defaultvalue=nz(dmax("datefieldname","tablename",""),now())

if table is empty this code brings today by default.

Atilla
 
Floyd Forbes said:
Hi

I have a form in which one field is called date. The dates
entered are often the same for a period of time so I would like the
default value for this field to be the same as the last entered date.
Can anybody please help me with how to do this.

Thank you

Private Sub Form_AfterUpdate()

With Me![Date]
.DefaultValue = Format(.Value, "\#mm/dd/yyyy\#")
End With

End Sub
 
Back
Top