Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / October 2004



Tip: Looking for answers? Try searching our database.

Newbie Help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andy Pandy - 30 Oct 2004 14:39 GMT
Need guidance and code to search an Access 2000 database for part of a word.
I know enough that you have to somehow implement InStr but dont know how to
do this. Code I have only returns if fall String is found.

Private Sub Command1_Click()
Dim search As String
search = InputBox("Enter Index", search)
Data1.Recordset.Index = "Index"
Data1.Recordset.Seek "=", search
If Data1.Recordset.NoMatch Then
Data1.Recordset.MoveFirst
End If
End Sub

Thanks in advance
Steve Gerrard - 30 Oct 2004 19:52 GMT
> Need guidance and code to search an Access 2000 database for part of a word.
> I know enough that you have to somehow implement InStr but dont know how to
[quoted text clipped - 11 lines]
>
> Thanks in advance

First of all, if you have a new question to ask, send it as
a new post, not as a reply to a post from six weeks ago.
You'll get more response. While you are at it, make the
title "Seach for Partial Word" or something more descriptive
than "Newbie Help".

Now to the question.

The simpliest way in your case will be to use FindFirst
instead of Seek. This means not using the index, but the
index won't help much for a partial word search anyway. (By
the way, "Index" is a terrible name for a field).

So replacing
> Data1.Recordset.Index = "Index"
> Data1.Recordset.Seek "=", search
with
   Data1.Recordset.FindFirst "[Index] Like '*" & search &
"*'"
should work.
Andy Pandy - 30 Oct 2004 20:06 GMT
Only joined group last week so don't know of any previous question of 6
weeks ago, sorry.

Many thanks for the help and will put a more descriptive header in the
future.

Kind regards and thanks

Andy

>> Need guidance and code to search an Access 2000 database
> for part of a word.
[quoted text clipped - 34 lines]
> "*'"
> should work.
Steve Gerrard - 30 Oct 2004 23:22 GMT
| Only joined group last week so don't know of any previous question of 6
| weeks ago, sorry.
[quoted text clipped - 5 lines]
|
| Andy

Actually my mistake. Apparently all posts with the subject "Newbie Help"
get listed by Outlook Express as replies to the oldest "Newbie Help"
post in my local list - in this case, one from Sep 18. On Google, they
are all listed together, dating back to 1997! Still, it is probably more
useful for other readers to describe the problem briefly in the subject
line.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.