Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display a pop up when subform isn't filtered

Status
Not open for further replies.

teachmecr

Programmer
Oct 1, 2006
72
0
0
US
Hi there

I have the following code on command button on the main form that displays customers names on the subform on finding a match from the text box.


txtCustname.SetFocus
strCustName = txtCustname.Text
If strCustName <> ""
Me.Subform.Visible = True
Me.Subform.Form.Filter = "CustName like '*" & strCustName & "*'"
Me.Form.FilterOn = True
txtCustname = ""
End If

All i wana do is to display a message saying "not found' when the entry from textbox doesnt match with any customer names in the view. Right now it just doens't display any records yet no message..just want to make it a little more user friendly...or unless i should do this searching some other way...thanks
 
If Trim(Me!txtCustname & "") <> "" Then
Me!Subform.Visible = True
Me!Subform.Form.Filter = "CustName Like '*" & Me!txtCustname & "*'"
Me.Form.FilterOn = True
Me!txtCustname = ""
If Me!Subform.Form.RecordSer.RecordCount = 0 Then
MsgBox "not found"
End If
End If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How are ya teachmecr . . .

This is academic for me in as much as [purple]a filter that returns no records shows exactly that[/purple] . . . no records!

Are you saying, when a user applies a filter that returns no records, [blue]they can't tell the difference? . . .[/blue] or is it your intend to display [blue]Nothing Found![/blue] before the records are displayed/filtered?

BTW: in [blue]PHV's[/blue] code:
Code:
[blue][tt]Change: If Me!Subform.Form.RecordSer.RecordCount = 0 Then
To:     If Me!Subform.Form.RecordSe[purple][b]t[/b][/purple].RecordCount = 0 Then[/tt][/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top