Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / April 2006

Tip: Looking for answers? Try searching our database.

COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Deenos2000@aol.com - 04 Apr 2006 15:58 GMT
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
Tim Marshall - 04 Apr 2006 16:16 GMT
> The above error occurs when I attempt to select any of the check boxes
> that are within this code.
[quoted text clipped - 4 lines]
>     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.
Signature

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 - 04 Apr 2006 21:43 GMT
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
Tim Marshall - 05 Apr 2006 12:42 GMT
> 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

Signature

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 - 05 Apr 2006 14:42 GMT
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 - 05 Apr 2006 15:07 GMT
> 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.
Signature

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 - 05 Apr 2006 15:11 GMT
This is the way i've been approaching it myself. Thanks for all your
help. The problem was solved.

Best
Deenos2000@aol.com - 05 Apr 2006 15:12 GMT
This is the way i've been approaching it myself. Thanks for all your
help. The problem was solved.

Best
RoyVidar - 04 Apr 2006 16:42 GMT
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.
[quoted text clipped - 10 lines]
> Thanks
> Deenos

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

Signature

Roy-Vidar

Deenos2000@aol.com - 04 Apr 2006 21:43 GMT
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

> Deenos2000@aol.com wrote in message
> <1144162692.581212.199210@z34g2000cwc.googlegroups.com> :
[quoted text clipped - 15 lines]
> Do you have subs or functions called CheckboxFalse and CheckboxTrue
> within the current scope?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.