Hello,
I am sure this has been discussed many times, but still having some problems in finding a solution for my db.
My form (frmMenu) has 4 textboxes, 4 cmd buttons and a unique listbox. Textboxes are used to type the queries criteria (I have 4 different queries).
The form also has another textbox that I use to count records in the listbox (txtsearchCount).
Below is an example of the code I am using behind a cmdbutton:
If Len(LNameSearch) & "" > 0 Then
Me.lstsearch.RowSource = "qryLname"
Me.lstsearch.Requery
Me.txtsearchCount = Me.lstsearch.ListCount - IIf(Me.lstsearch.ListCount = 0, 0, 1)
Me.txtsearchCount.Visible = True
End If
What I am trying to do is to add a simple msg box at the beginning of the code that will tell users if no records have been found. Something like this
if me.lstsearch has nor records (or the result of my query is 0 records, then......
MsgBox "Sorry, no records were found.", vbInformation, "Search Menu"
THank you
I am sure this has been discussed many times, but still having some problems in finding a solution for my db.
My form (frmMenu) has 4 textboxes, 4 cmd buttons and a unique listbox. Textboxes are used to type the queries criteria (I have 4 different queries).
The form also has another textbox that I use to count records in the listbox (txtsearchCount).
Below is an example of the code I am using behind a cmdbutton:
If Len(LNameSearch) & "" > 0 Then
Me.lstsearch.RowSource = "qryLname"
Me.lstsearch.Requery
Me.txtsearchCount = Me.lstsearch.ListCount - IIf(Me.lstsearch.ListCount = 0, 0, 1)
Me.txtsearchCount.Visible = True
End If
What I am trying to do is to add a simple msg box at the beginning of the code that will tell users if no records have been found. Something like this
if me.lstsearch has nor records (or the result of my query is 0 records, then......
MsgBox "Sorry, no records were found.", vbInformation, "Search Menu"
THank you