Default Value

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
 
A

Atilla Yildirim

On the form open event

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

if table is empty this code brings today by default.

Atilla
 
D

Dirk Goldgar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top