IM making project by simple "open the form base on your computer name"
I'm recovering the user name of the computer but my problem is it only work if the user in the first record
Expand|Select|Wrap|Line Numbers
- Private Sub Command2_Click()
- Dim CHECKINGMEEE As String
- Dim ashift As String
- CHECKINGMEEE = Environ("USERNAME")
- ashift = DLookup("[User Name]", "a shift NAME")
- bshift = DLookup("[User Name]", "b shift NAME")
- cshift = DLookup("[User Name]", "c shift NAME")
- dshift = DLookup("[User Name]", "d shift NAME")
- If CHECKINGMEEE = ashift Then
- DoCmd.OpenForm "A shift HISTRY"
- ElseIf bshift = CHECKINGMEEE Then
- DoCmd.OpenForm "B shift HISTRY"
- ElseIf cshift = CHECKINGMEEE Then
- DoCmd.OpenForm "C shift HISTRY"
- ElseIf dshift = CHECKINGMEEE Then
- DoCmd.OpenForm "D shift HISTRY"
- Else
- DoCmd.OpenForm "ANYTHING"
- End If
- DoCmd.Close acForm, "ENTER FACE"
- End Sub