Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2007

    Question Unanswered: Search returns no results

    Hi Everyone,

    I have a search button that searches records by social security number. If the search returns no results, I would like to have a dialog pop up stating no results were found. As of now, the only thing that happens is nothing If a record is not found. If one is found, it obviously displays that record. Any help on this probably simple code would be great. Thanks!

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    not too sure if the NOData event is triggered if a search finds no records, but if it does place some code in that event handler

    failing that you may have to write your own search function and do what you wish in that.
    collect user input
    then create a SQLstatement that say COUNTSs the number of rows that match the parameters or checks the rowcount is greater than 0
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    What is your current code to return a Record?

    If it's standard Combobox Wizard generated code, you could modify it like this:
    Private Sub ComboboxName_AfterUpdate()
        Dim rs As Object
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[SSNField] = '" & Me![ComboboxName] & "'"
        If rs.NoMatch Then
          Msgbox “No Match Found!”
         If Not rs.EOF Then Me.Bookmark = rs.Bookmark
        End If
    End Sub

    Linq ;0)>
    Last edited by Missinglinq; 05-29-13 at 11:43.
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Oct 2007
    The code is fairly simple and I am using a text box. I just want to have a dialog that if no results are found a message is desplayed.

    If Not IsNull(Me!FSS) Then
    Me.RecordSource = "Select * from [Claim Tracking System] where [Social Security] = '" & Forms![Claims Tracking System]!FSS & "'"

    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts