Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004

    Unanswered: Count Records Problem

    I have a Query that shows a table of results.
    i want to have a text box on my switchboard form that displays this number

    what is the best way to achieve this?

    I have tried but i must be doing something wrong

    thanks in advance for your time

  2. #2
    Join Date
    Jan 2005
    the following function will return the record count from a table or query

    Public Function CountRecords(TableName As String)
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Set db = CurrentDb
    Set rs = db.OpenRecordset(TableName)
    CountRecords = rs.RecordCount
    End Function

    put this function in a public module (not a form module)

    on your switch board's open event put the following code

    TextBox=CountRecords("your record name")

    hope this helps

Posting Permissions

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