Results 1 to 8 of 8
  1. #1
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Record number on subform (2K)

    I have created a form with a subform. The subform has been set up as a continuous form but as it has a memo field in it I have set subform just to show one record at a time. I have set small navigations buttons in the header of the form but to help the user I want to set up a text box (or 2 if necessary) that states they are looking at, say, record "2 of 3" or whatever record number they are viewing.

    Can you help me with the syntax please?
    Jerry

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

    Re: Record number on subform (2K)

    If you display only one record at a time, why not use a single form? The built-in navigation buttons will show exactly what you want.

    Otherwise, see ACC2000: How to Display Line Numbers on Subform Records.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Record number on subform (2K)

    Thanks Hans

    I see your point but I have been given a pre-developed back end schema(long story why---don't ask <img src=/S/grin.gif border=0 alt=grin width=15 height=15>). At short notice they wanted me to develop a quick fix "drill down" Access front end with a chain of 1-M tables. Each drill down pops up a master form with a sub-form show specific records. It is an interim solution with short deadline so design time is short, I just needed a quick fix to help the solution through.....thanks, a quick read of the link may do what I want, thanks
    Jerry

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Record number on subform (2K)

    Jerry,

    Here's some code I have used for this for users who needed BIG buttons and large numbers because of poor vision:

    <pre>
    Private Sub Form_Current()
    Call CountRecords
    End Sub 'Form_Current()

    Private Sub Form_Open(Cancel As Integer)
    Call CountRecords
    End Sub

    Public Function CountRecords()
    Dim rst As DAO.Recordset
    Dim lngCount As Long
    Set rst = Me.RecordsetClone
    With rst
    If Not .EOF Then
    .MoveLast
    lngCount = .RecordCount
    .MoveFirst
    Else
    lngCount = .RecordCount
    End If
    End With
    rst.Close
    'display the # of # string
    If lngCount = 0 Then
    [txtRecCount] = "0 of 0"
    Else
    [txtRecCount] = [CurrentRecord] & " of " & lngCount
    End If 'Me.RecordsetClone.RecordCount = 0
    Set rst = Nothing
    End Function 'CountRecords()</pre>


    txtRecCount is an unbound textbox and [CurrentRecord] gives you the number of the current record in the recordset.
    Charlotte

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

    Re: Record number on subform (2K)

    If they need large numbers, shouldn't you add 10,000 to the record number and record count? <img src=/S/innocent.gif border=0 alt=innocent width=20 height=20>

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Record number on subform (2K)

    Yes, but then they wouldn't fit in the textbox, so I decided to go with BIG numbers instead of large numbers. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Charlotte

  7. #7
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Record number on subform (2K)

    Don't you mean big <big>NUMBERS</big>? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  8. #8
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Record number on subform (2K)

    Very nice function Charlotte, now in my Collection, thank you
    Jerry

Posting Permissions

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