Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old July 11th, 2003, 10:07 AM
siriiven siriiven is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 1 siriiven User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old July 12th, 2003, 09:22 AM
Indain Indain is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 5 Indain User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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++

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Need help with a simple search


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway