Retrieve the number of record found

  • Thread starter JohnB762 via AccessMonster.com
  • Start date
J

JohnB762 via AccessMonster.com

Hello to everybody,
I would like to put the total number of record found in the list box in a
separate text box.

On click of the button "Find" I have this code

Private Sub Find_Click()
If Not IsNull(Me.ID) Then Me.List.RowSource = "Find_ID"
If Not IsNull(Me.DefunctInfo) Then Me.List.RowSource = "Find_DefunctInfo"
If Not IsNull(Me.FamilyVaults) Then Me.List.RowSource = "Find_FamilyVaults"
If Not IsNull(Me.Cbo_NicheInfo) Then Me.List.RowSource = "Find_NicheInfo"
If Not IsNull(Me.ExpireDate) Then Me.List.RowSource = "Find_ExpireDate"
If Not IsNull(Me.ExpireNiche) Then Me.List.RowSource = "Find_ExpireNiche"

If Me.List.ListCount = 0 Then
strMsg = MsgBox("No record found....!", vbExclamation, "Attention...")
End If
End Sub


Sorry for the question, but my VBA knowledge is really basic.
Thanks for your help
Regards
John
 
M

Mr B

If your listbox has the property "Column Heads" set to "No" then to place the
record count in your list box in a text box use:

Me.NameOfYourTextBox = Me.NameOfYourListBox.listcount

if the "Column Head" property is set to "Yes" then use:

Me.NameOfYourTextBox = Me.NameOfYourListBox.listcount -1
 
Top