Link to home
Start Free TrialLog in
Avatar of ggodwin
ggodwinFlag for United States of America

asked on

Today's date as a defalut date field in Access form.

I have a date field and I'd like to for it to add "Todays" date as a default. I need it to be editable so that I can change it if needed. Is there a simple way to do this?
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Just put it as default value in the text box on the form or in the field of the underlying table.
Here is on the form
User generated imageUser generated image
Here is on the table
User generated imageUser generated image
Avatar of ggodwin

ASKER

I got this to work. However, as I filter through records the value dis-appears.
what do you mean ?
This is a default value for New Records
Avatar of ggodwin

ASKER

I have a table that is being filed in using a form. However, the form has a filter built into it where you can select records. When the form opens it is filled in. However, once you select a different record in the filter window then it does not give a default value.

I know that is hard to follow.
How about defaulting the underlying field on the table that is used as recordset
I know that is hard to follow.

Indeed.
"Default" values pop-in when a new record is generated, but not an existing record.  If you want to pop-in today's date in an empty control (textbox?), then you can put code in the form's Current() event to check what's in the textbox and enter todays date if it is empty.  The process below covers a textbox that has a date data type control source:
Private Sub Form_Current()
    If Me.txtTextbox Is Null Then
        Me.txtTextbox = Date
    End If
End Sub

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.