Hi.
Is there a way to have a feild automatically filled upon entry? I have a
felid "Date"
Don't use Reserved words to name identifiers (fields, tables, queries,
forms, variables, et cetera). Date is a Reserved word because it's a VBA
function that will apply the present date to a value if you aren't careful.
(In other words, it could overwrite a previously saved date with today's
date, so you'll never know what the original date was.) I suggest that you
rename your field to something more descriptive, like InvoiceDate.
I would like to auto fill with current date/time when the
form is opened.
In your form's OnOpen( ) event, try:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo ErrHandler
Me!txtInvoiceDate.Value = Now()
Exit Sub
ErrHandler:
MsgBox "Error in Form_Open( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
End Sub
.. . . where txtInvoiceDate is the name of the text box displaying today's
date.
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips.
(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.