Message box shows twice

EleanorG

Registered User.
Local time
Today, 11:40
Joined
Oct 12, 2001
Messages
13
I have a search form...with a list box..

If there are no results - the message box comes up

If there are results - the message box comes up

I am totally bumfuzzled -

Private Sub cmdSearch_Click()
Me.Found.RowSource = "qrySearch"
Me.Found.Visible = True
If Me.Found.ItemsSelected.Count = 0 Then
MsgBox "Enter a New Search."
Exit Sub
End If


End Sub:mad:
 
I would assume that assining a row source and making visible at the start of the code means that there are no records slected by the time it gets to the if line

Peter
 
Right - the click runs the query - and populates the list with the results but that blinking message box pops up even when there ARE results. I stuck the message box in as an afterthought and now it comes up with or without results from the query...

Hope this makes sense
 
Code:
Private Sub cmdSearch_Click()
    Me.Found.RowSource = "qrySearch"
    [B]Me.Found.Requery[/B]
    Me.Found.Visible = True
       If Me.Found[B].ListCount[/B] = 0 Then
            MsgBox "Enter a New Search."
            Exit Sub
       End If
End Sub
 
Thank you - Thank you - I certainly do appreciate your help!!!!
 

Users who are viewing this thread

Back
Top Bottom