Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding a specific record using two fields

Status
Not open for further replies.

leangross

IS-IT--Management
Jul 3, 2002
84
0
0
PH

Is there a way i can use the Find method in VB to find a specific record using two fields without using a query?

I tried using the "AND" but it produce an error.

with rstCustomer
.find "lastname ='" & mlname & "' and firstname = '" & mfname & "'"
if .eof then
.addnew
. . .....
.update
end if
end with

The error is
3001 Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
 
Have you tried using the member access operator "!"?

rstCus.MoveFirst
For loops = 1 to rstCus.recordcount
IF rstCus!LastName = mlname AND rst!FirstName = mfname THEN

... do something ...

rstCus.MoveNext
END IF
Next loops


 
The find method does not support multi-column searches. This page can give you more details.


Your best bet is to incorporate your serach creiteria into your SQL statement.

Select * From table Where fisrtname='" & variable1 & "' and lastname='" & variable2 & "';" Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top