473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Exiting subroutines



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
2 1563

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hal Vaughan | last post by:
I have a class that is sometimes called from the command line and sometimes from another class. When the user clicks "Quit" on the panel it opens, if it is running from the command line, it...
3
by: joe | last post by:
Hello: I am using IIS 5.0, ASP and VBScript. I am puzzled by recurrences of errors when I nest subroutines, and I'd like to know if there are rules for that which I don't know. Would functions...
5
by: Tim Clacy | last post by:
When exiting function scope, which occurs first: a) destruction of local objects b) copy of value for return From disassembly of a debug target, it looks like the return value is copied before...
22
by: L. Westmeier | last post by:
Is there a way to have to exiting point in a void function? I don't want to exit the program but just this function. Any answers appreciated. L. Westmeier
8
by: Andrew Warren | last post by:
I'm trying to exit a Windows Forms application while in the form's constructor (after InitializeComponent() has been called) and am finding that calling Application.Exit () still leaves the form...
3
by: Bonj | last post by:
When trying to debug an ASP.NET project by placing a breakpoint in one of the functions in the codebehind, VS correctly stops at the breakpoint, and I can step through. But soon after, the process...
7
by: Microsoft | last post by:
I'm not sure where to physically place my subroutines in vb.net I get namespace and not declared errors... Imports System Imports System.Management Public Class Form1
3
by: OpticTygre | last post by:
I have a class, ProcessFiles, with several subroutines it runs for each type of file I want to "process." First, I check directories for files. Then, based on the filenames of those I find in...
5
by: Tim Werth | last post by:
I have a .NET console application that is kicked off by a .NET Windows service. They communicate via .NET Remoting, although there isn't much communication between the two while the console app is...
10
by: liz0001 | last post by:
Hi, I need to access an .asp subroutine file from a subdomain. i.e. the website is at www.domain.com and I want to access the same subroutines on the subdomain mobile.domain.com. The...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.