|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Need help with a simple search
I have an access database connected to my visual basic app. I want to be able to search for partial characters in a field and have it retrieve the closest find to that. Here is what I have so far:
Private Sub Search_Click() prompt$ = "Enter Address" searchstr$ = InputBox(prompt$, "Building") If searchstr$ <> "" Then Data1.Recordset.Index = "Building" 'use Building table Data1.Recordset.Seek "=", searchstr$ 'and search If Data1.Recordset.NoMatch Then 'if no match MsgBox ("Address not found MF!") Data1.Recordset.MoveFirst 'go to first record End If End If End Sub The search will work if I type in the exact record name, but i can';t search for a partial record. For example. One of my addresses is 100 WRR 8. I want to be able to type wrr, or just 8 and get results back. How would I do this? |
|
#2
|
|||
|
|||
|
hmm i had a similar problem like that and i solved it in a different way.
i used string function (see description in you help/msdn library) which find a string in a string and will give you result if the string function finds the search string in the string from the database.... the negative thing in this solution is you have to go thru the whole database and compare each result with string function... simple. Since my database ain't that big i don't have any performance problems. Hope it helped Ps. I didn't used Visual but i did it the way in php and c++ |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Need help with a simple search |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|