=RowNum([Form]) - equivalent in a report?

Discussion in 'Access VBA Modules' started by Opal, Mar 1, 2010.

  1. Opal

    Opal Guest

    I am running Access 2003 and found the following function:

    Public Function RowNum(frm As Form) As Variant
    On Error GoTo Err_RowNum
    'Purpose: Numbering the rows on a form.
    'Usage: Text box with ControlSource of: =RowNum([Form])

    With frm.RecordsetClone
    .Bookmark = frm.Bookmark
    RowNum = .AbsolutePosition + 1
    End With

    Exit_RowNum:
    Exit Function

    Err_RowNum:
    If Err.Number <> 3021& Then 'Ignore "No bookmark" at new row.
    Debug.Print "RowNum() error " & Err.Number & " - " &
    Err.Description
    End If
    RowNum = Null
    Resume Exit_RowNum
    End Function

    Which works really well on my forms. Is it possible to adapt
    something similar
    to use on a report?
     
    Opal, Mar 1, 2010
    #1
    1. Advertisements

  2. Opal

    vanderghast Guest

    Easier.

    Add a Text box.

    Make its control source property =1

    Make its Running Sum property Over All


    That's all.


    Vanderghast, Access MVP


    "Opal" <> wrote in message
    news:...
    >I am running Access 2003 and found the following function:
    >
    > Public Function RowNum(frm As Form) As Variant
    > On Error GoTo Err_RowNum
    > 'Purpose: Numbering the rows on a form.
    > 'Usage: Text box with ControlSource of: =RowNum([Form])
    >
    > With frm.RecordsetClone
    > .Bookmark = frm.Bookmark
    > RowNum = .AbsolutePosition + 1
    > End With
    >
    > Exit_RowNum:
    > Exit Function
    >
    > Err_RowNum:
    > If Err.Number <> 3021& Then 'Ignore "No bookmark" at new row.
    > Debug.Print "RowNum() error " & Err.Number & " - " &
    > Err.Description
    > End If
    > RowNum = Null
    > Resume Exit_RowNum
    > End Function
    >
    > Which works really well on my forms. Is it possible to adapt
    > something similar
    > to use on a report?
     
    vanderghast, Mar 1, 2010
    #2
    1. Advertisements

  3. Opal

    Opal Guest

    Thank you.... I'm always trying to make it harder on myself ;-)
     
    Opal, Mar 1, 2010
    #3
  4. Opal

    Guest

    in Report You can use Running Sum Property, But in Form You cannot use running Sum, So You need to use Code Above-mention
     
    , Dec 19, 2013
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Wembly

    ! DAO Equivalent of DMax !

    Wembly, Jul 19, 2003, in forum: Access VBA Modules
    Replies:
    1
    Views:
    148
    Marshall Barton
    Jul 19, 2003
  2. Amelia

    VBA equivalent to Access query criteria "in"

    Amelia, Jan 28, 2004, in forum: Access VBA Modules
    Replies:
    1
    Views:
    125
    Bas Cost Budde
    Jan 29, 2004
  3. Dave

    VB equivalent

    Dave, May 27, 2004, in forum: Access VBA Modules
    Replies:
    3
    Views:
    101
    Chris Nebinger
    May 27, 2004
  4. VBA equivalent to RECORDS -> SAVE RECORD

    , Nov 10, 2004, in forum: Access VBA Modules
    Replies:
    3
    Views:
    186
    Kevin K. Sullivan
    Nov 12, 2004
  5. John Avitt

    GetOpenFilename Equivalent

    John Avitt, Jan 12, 2005, in forum: Access VBA Modules
    Replies:
    2
    Views:
    279
    Douglas J. Steele
    Jan 12, 2005
  6. sassafrass
    Replies:
    1
    Views:
    107
    '69 Camaro
    Mar 22, 2005
  7. TarrynG

    Equivalent excel function in Access

    TarrynG, Apr 11, 2005, in forum: Access VBA Modules
    Replies:
    0
    Views:
    156
    TarrynG
    Apr 11, 2005
  8. Bill Reed via AccessMonster.com

    How do I accomplish the equivalent of hitting the {ESC} key in code?

    Bill Reed via AccessMonster.com, Apr 29, 2005, in forum: Access VBA Modules
    Replies:
    5
    Views:
    135
    Bill Reed via AccessMonster.com
    May 3, 2005
Loading...