Results 1 to 13 of 13

Thread: Message box problem [Resolved]

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Posts
    29

    Message box problem [Resolved]

    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim Search As String
    3.     Dim sql As String
    4.    
    5.      Search = InputBox("Enter Client ID", "Search Record")
    6.    
    7.     data1.Recordset.FindFirst "[Client ID]= '" & Search & "'"
    8.     sql = "SELECT * FROM Table1 WHERE [Client ID] = '" & Search & "'"
    9.         data1.RecordSource = sql
    10.         data1.Refresh
    11.        
    12.         If data1.Recordset.NoMatch Then
    13.          
    14.             MsgBox "Record Not Found!", vbExclamation, "Search Record"
    15.         Else
    16.             MsgBox "Record Found!", vbInformation, "Search Record"
    17.         End If            
    18. End Sub

    I wrote the above code to retrieve more than one records of a same client, and these records will be showed in a data grid. When record found/match, there will be a mesage box which displays "Record Found!", but the problem is when there is no record match, the message box still displays "Record Found!". I can't see anything wrong with the code/statement, any suggestion to make the message box display "Record Not Found!" when there is no record match?

    Thanks in advance!
    Last edited by hbin; Sep 20th, 2004 at 03:21 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width