Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

690 views
Skip to first unread message

Deeno...@aol.com

unread,
Apr 4, 2006, 10:58:12 AM4/4/06
to
The above error occurs when I attempt to select any of the check boxes
that are within this code.

Private Sub Check39_AfterUpdate()
If Check39 = True Then
CheckboxTrue 1
Else: CheckboxFalse 1
End Sub

I am using Access 2003. I've tried everything I could think. Can anyone
help on this?

Thanks
Deenos

RoyVidar

unread,
Apr 4, 2006, 11:42:56 AM4/4/06
to
Deeno...@aol.com wrote in message
<1144162692.5...@z34g2000cwc.googlegroups.com> :

Do you have subs or functions called CheckboxFalse and CheckboxTrue
within the current scope?

--
Roy-Vidar


Tim Marshall

unread,
Apr 4, 2006, 11:16:49 AM4/4/06
to
Deeno...@aol.com wrote:
> The above error occurs when I attempt to select any of the check boxes
> that are within this code.
>
> Private Sub Check39_AfterUpdate()
> If Check39 = True Then
> CheckboxTrue 1
> Else: CheckboxFalse 1
> End Sub

CheckboxTrue and CheckboxFalse are functions or subs in the above code.
Put your cursor on CheckboxTrue and right click and select "definition"
(you'll need to scroll down to near the bottom of the pop up menu). If
you get a message saying something like "Identifier under cursor is not
recognized" then that's your problem - CheckboxTrue is not defined
anywhere. Do the same to test CheckboxFalse.

It is likely that either or both of these functions is not defined.
When you select the check box Access is trying to follow the above code.
If it can't find CheckboxTrue or CheckboxFalse it says to itself "what
is this silly user trying to make me do? I just don't understand!" and
throws the error you are experiencing.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me

Deeno...@aol.com

unread,
Apr 4, 2006, 4:43:20 PM4/4/06
to
Thanks. It worked. I did not define it.
But now i am getting this error message that the database could not
find this form Mothers Information. The form name is spelt correctly
and does exist. Here is the code:

Public Function CheckBoxTrue(X As Integer)
Dim dbThe_Mothers_Circle As DAO.Database
Dim rstType As DAO.Recordset
Dim strSQl As String
Dim MCID As Integer
Dim Check As String

'adds mailing group number to recordset

MCID = Forms!Mothers_Information!MCID
strSQl = "SELECT * FROM Type_of_Participant_Info WHERE MCID = " & MCID
Set dbThe_Mothers_Circle = CurrentDb()
Set rstType = dbjoi.OpenRecordset(strSQl, dbOpenDynaset)
With rstType
.AddNew
.Fields("MCID") = MCID
.Fields("TypeID") = X
.Update
End With
rstType.Close
End Function

Deeno...@aol.com

unread,
Apr 4, 2006, 4:43:59 PM4/4/06
to

Tim Marshall

unread,
Apr 5, 2006, 7:42:03 AM4/5/06
to
Deeno...@aol.com wrote:

> But now i am getting this error message that the database could not
> find this form Mothers Information. The form name is spelt correctly
> and does exist. Here is the code:

> Dim MCID As Integer

> MCID = Forms!Mothers_Information!MCID

It's never a great idea to have actual spaces in an object, such as a
form or a control (text box, check box, etc) name. That said, try this:

Forms("Mothers Information").MCID

Deeno...@aol.com

unread,
Apr 5, 2006, 9:42:04 AM4/5/06
to
I am so rusty with this stuff it isn't funny. Where would you recommend
I go to learn ie. a school, Microsoft. I am in NY.

Tim Marshall

unread,
Apr 5, 2006, 10:07:01 AM4/5/06
to
Deeno...@aol.com wrote:

> I am so rusty with this stuff it isn't funny. Where would you recommend
> I go to learn ie. a school, Microsoft. I am in NY.

Depends on what your job is. I learned as I went, primarily by using
the help files (though these really, really suck in versions after
Access 97, which had an excellent help) and this newsgroup. Googling on
advanced google can help too, but there can be pitfalls if you pick an
out to lunch answer on a topic you're learning about. I would google
and confirm methods by asking here if you find multiple methods.

For google, see the current thread, "O.T. - Can I redownload a
particular thread I've deleted in Free Agent?" and fredG's first response.

A course could be a good idea to help you get started, for sure, but as
I am Newfoundland, Canada, I'm not familiar with NY state at all, sorry.

Deeno...@aol.com

unread,
Apr 5, 2006, 10:11:52 AM4/5/06
to
This is the way i've been approaching it myself. Thanks for all your
help. The problem was solved.

Best

Deeno...@aol.com

unread,
Apr 5, 2006, 10:12:00 AM4/5/06
to
0 new messages