473,513 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting the Sub or Function not defined error

Hi,

I'm using access 97 SR2 on win XP and keep getting the Sub or Function
not defined error message.

The code for the function is in a module called mod_Public and is as
follows.

Function IsLoaded(MyFormName As String)
' Determines if a form is loaded.

Const FORM_DESIGN = 0
Dim I As Integer

IsLoaded = False

For I = 0 To Forms.Count - 1
If Forms(I).FormName = MyFormName Then
If Forms(I).CurrentView <> FORM_DESIGN Then
IsLoaded = True
Exit Function
End If
End If
Next

End Function
I'm trying to run the module in the on close event of another form.
This code is as follows.

Private Sub Form_Close()
If IsLoaded("ERA") = True Then
Forms![ERA]![ctl_Tab]!Cmbo_BuildingId.Requery
End If

End Sub
Can anyone see what I am doing wrong?

Regards
Steve
Nov 13 '05 #1
6 7414
Do you have a space between If and IsLoaded?

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Steve Strik" <st********@hotmail.com> wrote in message
news:2e*************************@posting.google.co m...
Hi,

I'm using access 97 SR2 on win XP and keep getting the Sub or Function
not defined error message.

The code for the function is in a module called mod_Public and is as
follows.

Function IsLoaded(MyFormName As String)
' Determines if a form is loaded.

Const FORM_DESIGN = 0
Dim I As Integer

IsLoaded = False

For I = 0 To Forms.Count - 1
If Forms(I).FormName = MyFormName Then
If Forms(I).CurrentView <> FORM_DESIGN Then
IsLoaded = True
Exit Function
End If
End If
Next

End Function
I'm trying to run the module in the on close event of another form.
This code is as follows.

Private Sub Form_Close()
If IsLoaded("ERA") = True Then
Forms![ERA]![ctl_Tab]!Cmbo_BuildingId.Requery
End If

End Sub
Can anyone see what I am doing wrong?

Regards
Steve

Nov 13 '05 #2
Yes. As displayed.
"PC Datasheet" <no****@nospam.spam> wrote in message news:<pU*****************@newsread2.news.atl.earth link.net>...
Do you have a space between If and IsLoaded?

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Steve Strik" <st********@hotmail.com> wrote in message
news:2e*************************@posting.google.co m...
Hi,

I'm using access 97 SR2 on win XP and keep getting the Sub or Function
not defined error message.

The code for the function is in a module called mod_Public and is as
follows.

Function IsLoaded(MyFormName As String)
' Determines if a form is loaded.

Const FORM_DESIGN = 0
Dim I As Integer

IsLoaded = False

For I = 0 To Forms.Count - 1
If Forms(I).FormName = MyFormName Then
If Forms(I).CurrentView <> FORM_DESIGN Then
IsLoaded = True
Exit Function
End If
End If
Next

End Function
I'm trying to run the module in the on close event of another form.
This code is as follows.

Private Sub Form_Close()
If IsLoaded("ERA") = True Then
Forms![ERA]![ctl_Tab]!Cmbo_BuildingId.Requery
End If

End Sub
Can anyone see what I am doing wrong?

Regards
Steve

Nov 13 '05 #3
I found a fix.

I changed the following line in the Module and added "As Boolean" Works fine now.

Function IsLoaded(MyFormName As String) As Boolean

st********@hotmail.com (Steve Strik) wrote in message news:<2e*************************@posting.google.c om>...
Hi,

I'm using access 97 SR2 on win XP and keep getting the Sub or Function
not defined error message.

The code for the function is in a module called mod_Public and is as
follows.

Function IsLoaded(MyFormName As String)
' Determines if a form is loaded.

Const FORM_DESIGN = 0
Dim I As Integer

IsLoaded = False

For I = 0 To Forms.Count - 1
If Forms(I).FormName = MyFormName Then
If Forms(I).CurrentView <> FORM_DESIGN Then
IsLoaded = True
Exit Function
End If
End If
Next

End Function
I'm trying to run the module in the on close event of another form.
This code is as follows.

Private Sub Form_Close()
If IsLoaded("ERA") = True Then
Forms![ERA]![ctl_Tab]!Cmbo_BuildingId.Requery
End If

End Sub
Can anyone see what I am doing wrong?

Regards
Steve

Nov 13 '05 #4
st********@hotmail.com (Steve Strik) wrote in
news:2e**************************@posting.google.c om:
I found a fix.

I changed the following line in the Module and added "As
Boolean" Works fine now.

Function IsLoaded(MyFormName As String) As Boolean


You might also try explicitly declaring the function as public.

eg public function isloaded(....) as ...
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #5
Bob Quintal wrote:
st********@hotmail.com (Steve Strik) wrote in
news:2e**************************@posting.google.c om:

I found a fix.

I changed the following line in the Module and added "As
Boolean" Works fine now.

Function IsLoaded(MyFormName As String) As Boolean

You might also try explicitly declaring the function as public.

eg public function isloaded(....) as ...

I thought Public was the default?

--

\\\\\\
\\ \\ Windows is searching
\ \ For your sig.
\ \ Please Wait.
\__\

Nov 13 '05 #6
Trevor Best <nospam@localhost> wrote in news:4135b947$0$11814
$a*******@auth.uk.news.easynet.net:
Bob Quintal wrote:

You might also try explicitly declaring the function as public.

eg public function isloaded(....) as ...

I thought Public was the default?

Like many other things in VB, it sometimes helps the compiler to
restate the obvious. :) ISTR that it was private by default in
earlier versions of MsAccess.
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4936
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or...
3
2607
by: Intermouse | last post by:
Hi I keep getting an error: error C2664: 'GetProcAddress' : cannot convert parameter 1 from 'struct HINSTANCE__' to 'struct HINSTANCE__ *' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called My code is:
32
4963
by: paul | last post by:
HI! I keep on getting this error and I have tried different things but I am not sure how to send the expiring date. The error that I am getting in Firefox 1.5 is "Error: expires.toGMTString is not a function" ---------------------------------------------------- I have this in a .js file and in the head section.
4
7611
by: pavan734 | last post by:
Hello I have one .h file which I have includeded completely under #ifndef followed by #define guards. I have the member function definitions in the same .h file only. Still Iam getting linker errors saying that "multiple definition of the function: ". Iam getting that error for all the member functions of that class.
1
7869
by: sethuganesh | last post by:
HI, i have ported vc++ 6.0 code to visual studio 2005. During batch build in debug mode i din't get any error.But if i build the same in release mode i am getting the following error. LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in atlmincrt.lib(atlinit.obj) LIBCMT.lib(tidtable.obj) : error LNK2005:...
41
2826
by: Jim | last post by:
Hi guys, I have an object which represents an "item" in a CMS "component" where an "item" in the most basic form just a field, and a "component" is effectively a table. "item" objects can be created and then added to "component" objects to build up the component definition. My dilemma comes in deciding how to read/write data to the...
0
2613
by: rautsmita | last post by:
hello friends , i am using to jdk6 and JAXB2.0, i have geomtry.xsd file i am trying to compile this file using jaxb but i got some error i.e.The particle of the type is not a valid restriction of the particle of the base this xsd file is valid as per w3c standard i am also providing error in detail and geometry.xsd file geometry.xsd <?xml...
10
2909
by: Rahul Babbar | last post by:
Hi, I am getting the following error, while executing the simple insert script on a few tables. INSERT INTO <table_name>(<col1>) VALUES (1); DB2 SQL error: SQLCODE: -440, SQLSTATE: 42884, SQLERRMC: =;FUNCTION Message: No authorized routine named "=" of type "FUNCTION" having compatible arguments was found.
5
1621
by: tshad | last post by:
I have the following class in my VS 2008 project that has a namespace of MyFunctions. ********************************* Imports System Imports System.Text.RegularExpressions Namespace MyFunctions Public Class BitHandling
0
7177
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7559
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7123
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7542
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5701
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.