A number of ways to do this, of course! Is the order of events here
- Sign in to Logon Form
- Open WorkOrder Form
- Enter New Work Order
If so, something like this, using the OpenArgs parameter to pass the UserID:
In the Logon Form
Code:
Private Sub OpenWorkOrderForm_Click()
DoCmd.RunCommand acCmdSaveRecord
If Not IsNull(Me.UserID) Then
DoCmd.OpenForm "WorkOrderForm", , , , , , Me.UserID
Else
MsgBox "A User ID Must Be Entered First!"
End If
End Sub
In the WorkOrderForm
Code:
Private Sub Form_Load()
If Not IsNull(Me.OpenArgs) Then
DoCmd.GoToRecord , , acNewRec
Me.[Opened By] = Me.OpenArgs
End If
End Sub
The Square Brackets are only needed around the Opened By Control name if there is a Space in the name.
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007