How to prevent aForm from showing default value from table field in blank new record?

shwan

Registered User.
Local time
Today, 10:55
Joined
Nov 18, 2017
Messages
13
Hello,

I'm new to access and I have this little problem that is bothering me.
I have a subform based on a table that has a field with the default value set to current date using the date function.
Every time I open this subform an empty new record shows below whatever records is already there which is fine, the problem is that: this new blank record has nothing except the date, which is the default value from the table.
How can I prevent this date from showing until the user starts to actually enter a new record??

Thank you very much
 
Remove the default for the field.
Add it using code when a new record is entered.

Access also unhelpfully used to set the default for number fields to 0.
 
remove the Default Value from the table.
 
Thank you for your replies, If I remove the default value from the table, how could I add the date automatically when a new record is entered? I want the user to see that the date has been added. Can you please share the code for that.
 
use BeforeInsert code of the form;

Private Sub Form_BeforeInsert(Cancel As Integer)
Me.yourDateField = Date()
End Sub
 
use BeforeInsert code of the form;

Private Sub Form_BeforeInsert(Cancel As Integer)
Me.yourDateField = Date()
End Sub

Thank you very much, sir. That was helpful.
 
Set it as the Default Value for the Control, at the Form level...then, when a New Record is started, it'll automatically appear!

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom