Joe Hecht
jmhla at earthlink.net
Sat Nov 27 23:27:20 CST 2004
Private Sub cmdEmpDetails_Click() ' Comments : Open Employee form mased on cboEmpName ' Parameters: - ' Modified : ' ' -------------------------------------------------- On Error GoTo Err_cmdEmpDatails_Click Dim strStDocName As String Dim strStLinkCriteria As String Dim lngRetval As Long Dim frmCurrentForm As Form There is a combo box with a button to open another form on this form. The combo box value is null when this form opens. If the user clicks the button I want to open the message box and say try again. The message box code is not fireing. Would someone see what is not working here? If Me.cboEmpName.Value = " " Then 'If combobox value is null open message box lngRetval = MsgBox( _ "Please pitck an employee from the list or click on the close buttob", _ vbOKOnly + vbCritical + vbSystemModal + vbDefaultButton1, _ "Please pick Employee") Select Case lngRetval Case vbOK Set frmCurrentForm = Screen.ActiveForm ' Keep selection box form as active form End Select Else strStDocName = "Employee" strStLinkCriteria = "[EmpID]=" & "'" & Me![cboEmpName] & "'" DoCmd.OpenForm strStDocName, , , strStLinkCriteria End If Exit_cmdEmpDatails_Click: Exit Sub Err_cmdEmpDatails_Click: MsgBox Err.Description Resume Exit_cmdEmpDatails_Click End Sub JOE HECHT LOS ANGELES CA jmhla at earthlink.net