By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,165 Members | 850 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,165 IT Pros & Developers. It's quick & easy.

Exiting subroutines

P: n/a


I have the following script but am getting a compile error on the "If
CheckComboInput() Then" line. Any ideas what this problem might be?
Private Function CheckComboInput() As Integer
If IsNull(cboCountry) Then
MsgBox "You must choose a Country." & vbCrLf & _
"Please try again.", vbExclamation, "More information
required."
Me.cboCountry.SetFocus
CheckComboInput = False
Exit Sub
End If
CheckComboInput = True
End Sub
Private Sub cmdDateSheet_Click()
If CheckComboInput() Then
DoCmd.OpenQuery "qryStudentList_Country"
End If
End Sub
Marcus
******

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Marcus wrote:
I have the following script but am getting a compile error on the "If
CheckComboInput() Then" line. Any ideas what this problem might be?
Private Function CheckComboInput() As Integer
If IsNull(cboCountry) Then
MsgBox "You must choose a Country." & vbCrLf & _
"Please try again.", vbExclamation, "More information
required."
Me.cboCountry.SetFocus
CheckComboInput = False
Exit Sub
End If
CheckComboInput = True
End Sub
Private Sub cmdDateSheet_Click()
If CheckComboInput() Then
DoCmd.OpenQuery "qryStudentList_Country"
End If
End Sub


It's not going to compile with the "Exit Sub" or "End Sub" lines in
your CheckComboInput() function. Change those "Sub"'s to "Function"
and see if that fixes things.

Bruce

Nov 13 '05 #2

P: n/a
Marcus wrote:

I have the following script but am getting a compile error on the "If
CheckComboInput() Then" line. Any ideas what this problem might be?
Private Function CheckComboInput() As Integer
If IsNull(cboCountry) Then
MsgBox "You must choose a Country." & vbCrLf & _
"Please try again.", vbExclamation, "More information
required."
Me.cboCountry.SetFocus
CheckComboInput = False
Exit Sub
End If
CheckComboInput = True
End Sub
Private Sub cmdDateSheet_Click()
If CheckComboInput() Then
DoCmd.OpenQuery "qryStudentList_Country"
End If
End Sub
Marcus
******


See if changing the line
Private Function CheckComboInput() As Integer
to
Private Function CheckComboInput() As Boolean
works.
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.