Auto-Fill Fields on Open (1 Viewer)

Sol

Registered User.
Local time
Today, 14:24
Joined
Feb 24, 2000
Messages
31
From the navigator I'd like to open a form and auto-fill the created by & time fields. I've tryed using (in comments below) me.field name and formname.fieldname and both error out? Any suggestions...

Private Sub Command45_Click()
DoCmd.OpenForm "frmCustomer", , , , acFormAdd
'me.CreatedD_T.value = Now()
'frmCustomer.CreatedBy = CurrentUser()
End Sub

Thanks!
 

Travis

Registered User.
Local time
Today, 07:24
Joined
Dec 17, 1999
Messages
1,332
Add this code to the Form_BeforeInsert Event of frmCustomer

if me.NewRecord then
me.CreatedD_T.value = Now()
me.CreatedBy = CurrentUser()
end if

This event fires only on the first entry in the record. Thus it will not effect previous records. Again this will place the values in the record only when you start data entry. This is a safe way to prevent have incomplete records in the data because someone went in and then left.

hope this helps
 

Users who are viewing this thread

Top Bottom