JPRoy392
Sep 6th, 2000, 09:02 AM
Please Help -
I have searching a database (Access) for strings down cold. The problem that I am having is trying to do a search for fields in a database that are either characterized by date or number. (If I want to find an order number or the date an order was placed). Here is the code that I have for the string search:
code:
Option Explicit
Dim sFindString As String
Private Sub cmdFind_Click()
If optName.Value = True Then
If cmdFind.Caption = "F&ind" Then
sFindString = InputBox("Enter the Name of the Vendor")
If sFindString = "" Then
Exit Sub
End If
Adodc1.Recordset.Find "COMPANY Like '" & _
sFindString & "*'", 0, adSearchForward,
adBookmarkFirst
cmdFind.Caption = "F&ind Next"
Else
Adodc1.Recordset.Find "COMPANY Like '" & _
sFindString & "*'", 1, adSearchForward,
adBookmarkCurrent
End If
If Adodc1.Recordset.EOF Then
MsgBox "Match Not Found", _
vbInformation, "Vendor Search"
Adodc1.Recordset.MoveFirst
cmdFind.Caption = "F&ind"
End If
Thank you for any help
I have searching a database (Access) for strings down cold. The problem that I am having is trying to do a search for fields in a database that are either characterized by date or number. (If I want to find an order number or the date an order was placed). Here is the code that I have for the string search:
code:
Option Explicit
Dim sFindString As String
Private Sub cmdFind_Click()
If optName.Value = True Then
If cmdFind.Caption = "F&ind" Then
sFindString = InputBox("Enter the Name of the Vendor")
If sFindString = "" Then
Exit Sub
End If
Adodc1.Recordset.Find "COMPANY Like '" & _
sFindString & "*'", 0, adSearchForward,
adBookmarkFirst
cmdFind.Caption = "F&ind Next"
Else
Adodc1.Recordset.Find "COMPANY Like '" & _
sFindString & "*'", 1, adSearchForward,
adBookmarkCurrent
End If
If Adodc1.Recordset.EOF Then
MsgBox "Match Not Found", _
vbInformation, "Vendor Search"
Adodc1.Recordset.MoveFirst
cmdFind.Caption = "F&ind"
End If
Thank you for any help