|
-
Sep 6th, 2000, 09:02 AM
#1
Thread Starter
Member
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
Jim
"...head is all empty and I don't care..."
-
Sep 6th, 2000, 10:34 AM
#2
Frenzied Member
For numeric data, don't wrap the variable (use 25 instead of "25").
For dates, (and Access) use the "#" to wrap the date.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|