COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Deenos2000@aol.com

    COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

    The above error occurs when I attempt to select any of the check boxes
    that are within this code.

    Private Sub Check39_AfterUp date()
    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

    #2
    Re: COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

    Deenos2000@aol. com wrote in message
    <1144162692.581 212.199210@z34g 2000cwc.googleg roups.com> :[color=blue]
    > The above error occurs when I attempt to select any of the check boxes
    > that are within this code.
    >
    > Private Sub Check39_AfterUp date()
    > 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[/color]

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

    --
    Roy-Vidar


    Comment

    • Tim Marshall

      #3
      Re: COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

      Deenos2000@aol. com wrote:[color=blue]
      > The above error occurs when I attempt to select any of the check boxes
      > that are within this code.
      >
      > Private Sub Check39_AfterUp date()
      > If Check39 = True Then
      > CheckboxTrue 1
      > Else: CheckboxFalse 1
      > End Sub[/color]

      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

      Comment

      • Deenos2000@aol.com

        #4
        Re: COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

        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_C ircle 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_I nformation!MCID
        strSQl = "SELECT * FROM Type_of_Partici pant_Info WHERE MCID = " & MCID
        Set dbThe_Mothers_C ircle = CurrentDb()
        Set rstType = dbjoi.OpenRecor dset(strSQl, dbOpenDynaset)
        With rstType
        .AddNew
        .Fields("MCID") = MCID
        .Fields("TypeID ") = X
        .Update
        End With
        rstType.Close
        End Function


        RoyVidar wrote:[color=blue]
        > Deenos2000@aol. com wrote in message
        > <1144162692.581 212.199210@z34g 2000cwc.googleg roups.com> :[color=green]
        > > The above error occurs when I attempt to select any of the check boxes
        > > that are within this code.
        > >
        > > Private Sub Check39_AfterUp date()
        > > 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[/color]
        >
        > Do you have subs or functions called CheckboxFalse and CheckboxTrue
        > within the current scope?
        >
        > --
        > Roy-Vidar[/color]

        Comment

        • Deenos2000@aol.com

          #5
          Re: COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

          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_C ircle 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_I nformation!MCID
          strSQl = "SELECT * FROM Type_of_Partici pant_Info WHERE MCID = " & MCID
          Set dbThe_Mothers_C ircle = CurrentDb()
          Set rstType = dbjoi.OpenRecor dset(strSQl, dbOpenDynaset)
          With rstType
          .AddNew
          .Fields("MCID") = MCID
          .Fields("TypeID ") = X
          .Update
          End With
          rstType.Close
          End Function

          Comment

          • Tim Marshall

            #6
            Re: COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

            Deenos2000@aol. com wrote:
            [color=blue]
            > 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:[/color]
            [color=blue]
            > Dim MCID As Integer[/color]
            [color=blue]
            > MCID = Forms!Mothers_I nformation!MCID[/color]

            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").M CID

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

            Comment

            • Deenos2000@aol.com

              #7
              Re: COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

              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.

              Comment

              • Tim Marshall

                #8
                Re: COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

                Deenos2000@aol. com wrote:
                [color=blue]
                > 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.[/color]

                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

                Comment

                • Deenos2000@aol.com

                  #9
                  Re: COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

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

                  Best

                  Comment

                  • Deenos2000@aol.com

                    #10
                    Re: COMPILE ERROR: SUB OR FUNCTION NOT DEFINED

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

                    Best

                    Comment

                    Working...