Display the amount of records in a column as a message box when a button it clicked RRS feed

  • Question

  • I have developed a student admission system in MS Access. I want to create a form with a button that when clicked, a message box will come up with the amount of records within the Primary Key of a table. Primary is the student ID, therefore, the message box will tell the user how many students are enrolled.

    I hope someone can help!


    Friday, May 18, 2018 6:27 PM


  • Hi Jasmine,

    You could try using the DCount() function. For example:

    Msgbox "There are " & DCount("StudentID", "TableName") & " students enrolled.", vbInformation, "Registration"

    Hope it helps...

    Friday, May 18, 2018 6:35 PM