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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to have the record set to mo

Status
Not open for further replies.

lalee5

Technical User
Oct 20, 2002
70
US
I need to have the record set to move to the records that match text1.text.

the problem is proproductdescription is a description field. with mean that text1 has to match exactly to proproductdescription. I want the record to navigate to the first record that match the first letter that I type and the second letter and so on in text1.


ex: if I type in C the recordset should move to the first record that begin with the letter C, if I add H to the C the recordset should move to the first record that begin with CH....

Does that make sense?

below is how I code it but is not doing it unless text1 identical to one of the record in my database.


on text1_change:

Adoproducts.Recordset.Sort = "proProductdescription"


Adoproducts.Recordset.MoveFirst
Searchcriteria = "proproductdescription =" & Text1.Text
Call Adoproducts.Recordset.Find(Searchcriteria)



thanks!
 
You can use the "Like" statement to match partial criteria. e.g
Code:
rst.Find "MYFIELD LIKE '%" & SearchCriteria & "%'"
 
Did you want to move to the recordset for a particular reason? LIke perhaps to imitate the autofill feature? Otherwise, I see no reason to move to a particular record as you type as it wastes unnecessary system resources.
[bigcheeks]
 
I have a database of 1500 records. if the user does not know the product number they can move thru the data grid to find the record.it is too slow.

I need for the user to type the begining of the word and have the record set to move to the beginning of words that start with the letters that the user type



KAy
 
Hi Lalee5
Sounds like you need to find a matching record on a grid rather than in a recordset. I assume that you have filled a grid with the necessary data. All you will need to do then is on the text change event, search through the grid using the mid function and highlight that particular row.
Is the reason you are searching the recordset because you are you using DBGrid?
[bigcheeks]
 
DeltaTech , thats correct. but How do you code for the mid function. Please show me the code because I am new to vb and have no idea to code what you suggested. thanks


Plus:


How do you get a datagrid to sort when you set its data source to an adodc.

Below is code but it says the method is not supported:
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\CPOS\CPOSdata.mdb;Persist Security Info=False"
Set CN = New ADODB.Connection
CN.Open strConn



stcnQL2 = "SELECT * FROM toffproducts where proproducttype=" & "'" + Text13.Text + "'"



Set RS2 = New ADODB.Recordset


With RS2
.ActiveConnection = CN
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Properties("IRowsetIdentity") = True
.Open stcnQL2, , , , adCmdText



End With





Set Adodc2.Recordset = RS2
adodc2.recordset.sort="Productno"
Set DataGrid5.DataSource = Adodc2.Recordset






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top