T
Tandy
Right now I have a form to enter an employee's family. To make it easier on
the user, when they open the form they are prompted for the employee ID whose
family they are entering. The number they input is then set as the default in
the EmployeeID textbox. The code for this is below. I have tried to modify
the code so when the user opens the form they will also be prompted to enter
the employee's last name and that last name will be set as the default in the
LastName textbox. Unfortunately I'm not that great with code. Any help would
be appreciated!
Code:
Private Sub Form_Open(Cancel As Integer)
Dim strDefault As String
Dim fGotDefault As Boolean
Do
strDefault = InputBox("Enter the employee ID of the employee whose
family information you would like to enter:")
If Len(strDefault) = 0 Then
fGotDefault = True
Else
If IsNumeric(strDefault) Then
fGotDefault = True
Else
MsgBox "That's not a valid employee ID!"
End If
End If
Loop Until fGotDefault
If Len(strDefault) > 0 Then
Me!EmployeeID.DefaultValue = strDefault
End If
End Sub
Thanks,
Tandy
the user, when they open the form they are prompted for the employee ID whose
family they are entering. The number they input is then set as the default in
the EmployeeID textbox. The code for this is below. I have tried to modify
the code so when the user opens the form they will also be prompted to enter
the employee's last name and that last name will be set as the default in the
LastName textbox. Unfortunately I'm not that great with code. Any help would
be appreciated!
Code:
Private Sub Form_Open(Cancel As Integer)
Dim strDefault As String
Dim fGotDefault As Boolean
Do
strDefault = InputBox("Enter the employee ID of the employee whose
family information you would like to enter:")
If Len(strDefault) = 0 Then
fGotDefault = True
Else
If IsNumeric(strDefault) Then
fGotDefault = True
Else
MsgBox "That's not a valid employee ID!"
End If
End If
Loop Until fGotDefault
If Len(strDefault) > 0 Then
Me!EmployeeID.DefaultValue = strDefault
End If
End Sub
Thanks,
Tandy