Home > Archive > MS Access database support > April 2006 > COMPILE ERROR: SUB OR FUNCTION NOT DEFINED









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author COMPILE ERROR: SUB OR FUNCTION NOT DEFINED
Deenos2000@aol.com

2006-04-04, 11:34 am

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

2006-04-04, 11:34 am

Deenos2000@aol.com wrote in message
<1144162692.581212.199210@z34g2000cwc.googlegroups.com> :
> 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


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

--
Roy-Vidar


Tim Marshall

2006-04-04, 11:34 am

Deenos2000@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
Deenos2000@aol.com

2006-04-04, 8:30 pm

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_Inform
ation!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


RoyVidar wrote:
> Deenos2000@aol.com wrote in message
> <1144162692.581212.199210@z34g2000cwc.googlegroups.com> :
>
> Do you have subs or functions called CheckboxFalse and CheckboxTrue
> within the current scope?
>
> --
> Roy-Vidar


Deenos2000@aol.com

2006-04-04, 8:30 pm

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_Inform
ation!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

Tim Marshall

2006-04-05, 9:35 am

Deenos2000@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_Inform
ation!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

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Deenos2000@aol.com

2006-04-05, 9:35 am

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

2006-04-05, 9:35 am

Deenos2000@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.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Deenos2000@aol.com

2006-04-05, 9:35 am

This is the way i've been approaching it myself. Thanks for all your
help. The problem was solved.

Best

Deenos2000@aol.com

2006-04-05, 9:35 am

This is the way i've been approaching it myself. Thanks for all your
help. The problem was solved.

Best

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com