default on form

M

mark r

In table 1 I set servicedate in the table to have default of date()
Instead of this, I came up with the idea that whenever I click the command
button to open form1, a dialog box/message box opens up tfor me to input a
date into a "variable" which populates the servicedate as a default value for
each new record.

I tried placing [test] in the default property for the form's servicedate
textbox and I thought of placing [text] in the default value of the table's
servicedate definiton...................would any of that work.....how do I
go about doing this?
 
O

Ofer

Hi Mark
In the Load event of the form, you can prompt the user to select the default
value.

Me.FieldName.DefaultValue = InputBox("Please select default")
 
M

Marshall Barton

mark said:
In table 1 I set servicedate in the table to have default of date()
Instead of this, I came up with the idea that whenever I click the command
button to open form1, a dialog box/message box opens up tfor me to input a
date into a "variable" which populates the servicedate as a default value for
each new record.


A fairly common approach is to skip the input box and just
remember the value that the user enters into the date field.

Sub thetextbox_AfterUpdate()
Me.thetextbox.DefaultValue = " & _
Format(Me.thetextbox, "\#m\/d\/yyyy\#")
End Sub

This way, the user enters the desired date value in the
first new record normally, and subsequent records will get
the same date as the default. If the user then wants a
different default date for another bunch of new records,
s/he just enters the new date and it then becomes the
default.
 
Top