Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 17th, 2005, 03:59 AM
Registered User
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Searching a String

If I have a search form which contain some search key and they are in text fields. I just want to search my the value i wanted

eg if I just key in A123 in the cert no field in the search form it can show records like
Name Cert No
  A A123
or if i key in A123, B234, C345 these 3 records in in the cert no field in the search form it show all records which contain any of these 3 values
it shows like
Name Cert No
  A A123
  B B234
  C C345

Old August 17th, 2005, 09:45 AM
Friend of Wrox
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

I am not sure how you are implenting this. You just pass the field as parameters to the query behind your results form or report. Like this:

Dim stSearchValue As String
Dim stLink As String
Dim stDocName As String

stSearchValue = Me.TextFieldValue
stLink = "[SearchField] = Like " & "'" & stSearchValue & "'" & "*"

stDocName = YourFormOrReportName
DoCmd.Open(Form or Report) stDocName, , stLink

You may have to play with the syntax a little for the wildcard. This assumes the search value is at the beginning of the string. It can be in the middle or at the end. I have done this but don't have time to find it right now. Let me know if you still need help on this, or another poster can jump in.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching Within String zaeem Classic ASP Databases 3 May 10th, 2005 01:06 AM
Searching Within String zaeem VB Databases Basics 1 May 9th, 2005 03:04 PM
Searching for a string.... interrupt Javascript How-To 2 February 7th, 2005 01:00 PM
String Searching in a Table umagrama Access VBA 3 December 5th, 2003 12:25 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.