Hi,
I have a simple combo box where a user makes a choice, clicks a command button, and the corresponding form opens so the user can perform edits. That piece works fine. I cannot validate whether the combo box is actually empty when the command button is clicked (thereby redirecting user to make a choice).
Here is my code:
Code Tags added by UG
Why doesn't my validation work?
I have a simple combo box where a user makes a choice, clicks a command button, and the corresponding form opens so the user can perform edits. That piece works fine. I cannot validate whether the combo box is actually empty when the command button is clicked (thereby redirecting user to make a choice).
Here is my code:
Code Tags added by UG
Code:
Private Sub btnOpenForm4Editing_Click()
Dim stDocName As String
On Error GoTo HandleError
stDocName = Me.cboTableNames
If IsNull(Me.cboTableNames) Then
MsgBox "Please Choose a Form Name!", vbOKOnly
Me.cboTableNames.SetFocus
Else
'Open the form identified in the drop down choice
DoCmd.OpenForm stDocName
End If
HandleExit:
Exit Sub
HandleError:
MsgBox Err.Description
Resume HandleExit
End Sub
Why doesn't my validation work?
Last edited by a moderator: