Display the number of records found

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • onyris
    New Member
    • Aug 2008
    • 42

    #16
    I have added an "end if " at the end and is not giving any errors now , but is not displaying the number on the label.
    Code:
    Private Sub Form_Current()
    If Me![List49].ListIndex = -1 Then
    Me![Label37].Caption = Me.CurrentRecord
    Else
    Me![Label37].Caption = Me![List49].ListIndex + 1
    End If
    End Sub
    Anything wrong with the code?
    Last edited by NeoPa; May 21 '09, 01:31 PM. Reason: Please use the [CODE] tags provided.

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #17
      Originally posted by onyris
      I have added an "end if " at the end and is not giving any errors now , but is not displaying the number on the label.
      Code:
      Private Sub Form_Current()
      If Me![List49].ListIndex = -1 Then
      Me![Label37].Caption = Me.CurrentRecord
      Else
      Me![Label37].Caption = Me![List49].ListIndex + 1
      End If
      End Sub
      Anything wrong with the code?
      Are you sure that your Label is named Label37, and in fact it is a Label, and not a Text Box Control since a Text Box does not have a Caption Property?

      Comment

      • onyris
        New Member
        • Aug 2008
        • 42

        #18
        Are you sure that your Label is named Label37, and in fact it is a Label, and not a Text Box Control since a Text Box does not have a Caption Property?
        Yes , 100%.

        The code is in Form_current().
        this is the right place or it should be in the Form_load()?

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #19
          Originally posted by onyris
          Yes , 100%.

          The code is in Form_current().
          this is the right place or it should be in the Form_load()?
          The Form's Current() Event is the right location. Can't understand why it is not working, I've had no problems on this end.

          Comment

          • onyris
            New Member
            • Aug 2008
            • 42

            #20
            The Form's Current() Event is the right location. Can't understand why it is not working, I've had no problems on this end.
            Had a look again over the names and the code , everything is ok .
            Why is it not working?

            Comment

            • onyris
              New Member
              • Aug 2008
              • 42

              #21
              right , i have changed a bit , and on the List49 click event i have added this code:
              Code:
              Me![Label37].Caption = Me![List49].ListIndex + 1
              It is working now.

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32633

                #22
                Onyris,

                How about you put a breakpoint on line #2 and debug (Debugging in VBA) it to find out what's going wrong where. Does this sound like something you'd be interested in?

                Comment

                • ADezii
                  Recognized Expert Expert
                  • Apr 2006
                  • 8834

                  #23
                  Originally posted by onyris
                  right , i have changed a bit , and on the List49 click event i have added this code:
                  Code:
                  Me![Label37].Caption = Me![List49].ListIndex + 1
                  It is working now.
                  Wasn't that indicated in Post #12?

                  Comment

                  Working...