Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Oct 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Number Rows on a Form (2003)

    Hi

    I would like to number the records on a Subform I have. The Subform is set to Continuous Rows. I have turned off the Navigation Buttons, which would logically show me which Record I've selected, so now I don't know which Record I'm on when I click on it in the Subform. Logically, you would say, "well turn them back on", but I'd rather have a text box next to each Row that tells me what number it is in the Subform.

    I've consulted the Help File, Looked at the Properties Page, and done a Search of this Forum to see if there's a way to do it, but I can't see how.

    This is only for aesthetic reasons, so it's not a tragedy if I can't do this, but if it's possible, I would love to know how.

    Thanks for any advice. [img]/forums/images/smilies/smile.gif[/img]

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Number Rows on a Form (2003)

    Here's a function that may work:

    Public Function SequentialNumber(Optional pvSeed As Variant = Null) As Long
    Static Value As Long
    If Not IsNull(pvSeed) Then
    Value = Value + 1
    Else
    Value = 0
    End If
    SequentialNumber = Value
    End Function

    called is a query like this:

    SELECT stuff, sequentialNumber(stuff) FROM Table1;

    "stuff" is a fieldname in Table1. The reference to Stuff in the function call is vital -- it forces the function to be evaluated for each record. Otherwise, it gets evaluated once, and every record gets the same value for SequentialNumber.

    Unfortunately, as you scroll up and down your continuous subform, the function is called repeatedly, which will renumber the records.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Number Rows on a Form (2003)

    Also see ACC2000: How to Display Line Numbers on Subform Records (the technique should work in Access 2003 too.)

  4. #4
    New Lounger
    Join Date
    Oct 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Number Rows on a Form (2003)

    Thanks for your replies.

    I tried both solutions but couldn't get eithet to work, so I guess I'm not clever enough to implement this function.

    As stated, it's not urgent, so I'll just make do with the extra Navigation Bar.

    Thank you anyway for your help. Much appreciated.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Number Rows on a Form (2003)

    If you would still like to try it (now or perhaps later), the MSKB article I referred to contains a link to download a sample database with a working example of line numbers in a subform. You could study how it is done there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •