Click to See Complete Forum and Search --> : ADO Search Record Function


qiaojun
August 10th, 2001, 03:24 AM
Can anyone show me the general code for a serch function? Here is the scenario:
In a Product form, it contains Product Name, Unit Price. After a "search" button is clicked and input box will be displayed. This "Search" function is based on "Product Id". after "product Id" is entered, The program will find the corresponding record and display it on the Product form. The database is linked using ADODC. Please let me know how to code this program.

Iouri
August 10th, 2001, 07:14 AM
The best way to perform sewrch is to use SQL. Enetr your RecordID to the input box and then execute the SQL
Save your input into variable
dProductID if it is a number
sProductID if it is a string

a.Number
sSQL = "select * from YourTable where ProductID = " & dProductID
b.String
sSQL = "select * from YourTable where ProductID = '" & sProductID & "'"


adodc1.DtaSource = sSQL

Iouri Boutchkine
iouri@hotsheet.com

urs
August 10th, 2001, 03:07 PM
adodc1.recordset.find "Product Id='" & productid & "'"

qiaojun
August 11th, 2001, 01:16 AM
So, after performing finding, i wish to know if this recrd exists in my database. What shall i do next?