A
Andrew C
Hi All
on my main page to my database i have a command button that opens a second
form based on a staff member selected in the combo box. Currently if they
leave the combo box blank it automatically selects its own staff member.
what i would like it to do is if the combo bos is empty to display a msg box
saying "Please Select Staff Member".
I have attached the current code i have for the command button
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Staff Contact"
If Not IsNull(Me![Combo13]) Then
stLinkCriteria = "[Contact.StaffMember]=" & Me![Combo13]
Else
stLinkCriteria = ""
End If
DoCmd.OpenForm stDocName, , , stLinkCriteria
Dim strForm As String
strForm = "Main"
If CurrentProject.AllForms(strForm).IsLoaded Then
DoCmd.Close acForm, strForm
End If
Exit_Command10_Click:
Exit Sub
Err_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click
End Sub
Thanks in advance
on my main page to my database i have a command button that opens a second
form based on a staff member selected in the combo box. Currently if they
leave the combo box blank it automatically selects its own staff member.
what i would like it to do is if the combo bos is empty to display a msg box
saying "Please Select Staff Member".
I have attached the current code i have for the command button
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Staff Contact"
If Not IsNull(Me![Combo13]) Then
stLinkCriteria = "[Contact.StaffMember]=" & Me![Combo13]
Else
stLinkCriteria = ""
End If
DoCmd.OpenForm stDocName, , , stLinkCriteria
Dim strForm As String
strForm = "Main"
If CurrentProject.AllForms(strForm).IsLoaded Then
DoCmd.Close acForm, strForm
End If
Exit_Command10_Click:
Exit Sub
Err_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click
End Sub
Thanks in advance