Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What data to be entered on form 1

Status
Not open for further replies.

sparkbyte

Technical User
Sep 20, 2002
879
US
I have an employee table that I would like the user to fill in if the Employee ID is not found in the table.

I am having a problem with setting up the loop properly.

I need it to wait for the user to press the "save & Close Button" on the form before rechecking for the EmployeeID.

Code:
Private Sub Form_Load()
On Error GoTo Err_Handler

Do While IsNull(DLookup("EmployeeID", "tblEmployee", "EmployeeID=" & "'" & fOSUserName & "'"))
    MsgBox ("Employee ID not found." & vbCrLf & _
            "Please enter your Information.")
    DoCmd.OpenForm "frmEmployees", acNormal, , , acFormAdd, acWindowNormal
Loop


' ShowDbWindow (False)

        Me.btnMailroomMenu.Visible = False
        Me.btnOperationsMenu.Visible = False

    If IsMember(GetCurrentDomain, "NRC Mailroom SQL Users - CIS", fOSUserName) = True Then
        Me.btnMailroomMenu.Visible = True
    ElseIf IsMember(GetCurrentDomain, "NRC CENTOPS - CIS", fOSUserName) = True Then
        Me.btnOperationsMenu.Visible = True
        Me.btnMailroomMenu.Visible = True
    ElseIf IsMember(GetCurrentDomain, "NRCITS-CIS", fOSUserName) = True Then
        Me.btnOperationsMenu.Visible = True
        Me.btnMailroomMenu.Visible = True
        
        Dim result As String
            result = MsgBox("Open the Database Window?", _
                     vbInformation + vbYesNo, "Access DB Window")
                Select Case result
                  Case 1, 4, 5, 6  'yes
                    ShowDbWindow (True)
                  Case 2, 3, 7  'No
                    ShowDbWindow (False)
                End Select
                
    Else
        'Do Nothing
    End If
    
endit:
Exit Sub

Err_Handler:
 If StandardErrors(Err) = False Then
    BeepWhirl
    MsgBox Err & ": " & Err.Description
 End If
Resume endit

End Sub


Thanks

John Fuhrman
 
DoCmd.OpenForm "frmEmployees", acNormal, , , acFormAdd, [!]acDialog[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Always the simple solution that seems to stump me.

Thanks again!!

Thanks

John Fuhrman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top