Recordset.Recordcount problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alireza355
    New Member
    • Feb 2009
    • 86

    Recordset.Recordcount problem

    Dear all,

    a few years ago, I made an access database with a lot of forms, queries, etc...

    I stopped using the database for a few years, and now that I went back to it, I notice a problem:

    In a form, I have a textbox that for it's control source it has:

    =[forms]![frmMAINFORM]![frmSUBFORM].[form].[recordset].[recordcount]

    but it returns #Name

    It seems like it doesn't know anything about recordset.

    Any ideas????
  • jforbes
    Recognized Expert Top Contributor
    • Aug 2014
    • 1107

    #2
    I'm not sure, but I think there was a point in time when that would work. It doesn't work now, which you found out.

    I haven't been able to come up with a single line of code that will work as a ControlSource. Instead I would make the ControlSource for your control like this:
    Code:
    =GetSubRecordsetCount()

    and then add something like the following as VBA Code for your Form. This should work if the control for your subform is named 'frmSUBFORM', otherwise replace it in the code below with the actual name of your SubForm Control.
    Code:
    Private Function GetSubRecordsetCount()
        GetSubRecordsetCount = Me.frmSUBFORM.Form.RecordsetClone.RecordCount
    End Function

    Comment

    • Alireza355
      New Member
      • Feb 2009
      • 86

      #3
      Dear jforbes,

      thank you for your response. I will give it a try and let you know.

      Comment

      • Alireza355
        New Member
        • Feb 2009
        • 86

        #4
        Yes, it works. thanx a lot....

        Comment

        Working...