assign value to field

S

skopp

I'm creating my first Access (2003) database and I think this should be a
simple question. I've created a form that enters information from the user in
a table. When they click the button to "Add new record", I want to
automatically enter other values in the table. For example, I want to put in
today's date in one field. Is there a simple command I can enter in the
button's VBA code that will do this?

Thanks.
 
K

Ken Snell \(MVP\)

Me.NameOfControl.Value = "My Value"
Me.NameOfControl.Value = Date()
etc.
 
J

J

Set the default value in the table design to Date()
If you get a pop-up after you do that, choose yes to propagating
throughout your forms.
 
K

Klatuu

Each control on a form has a Default Value property. It only applies to new
records. Enter the value or formula you want for new records.
 
Top