Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Search string to search for wild terms in Access database

I have been desperately trying to figure this out and I'm stumped. So
I'm turning to my fellow Google Groupers.

I have a macro enriched Excel file that calls/edits information in a
MS Access database. There are about 20 fields in the database. I'm
using ADODB connection/recordset codings to get/edit my information.
I know how to code a SEARCH string in order to find one field of
information, but not multiple fields.

For example, I manage a database of permits. A few of the fields in
my database are permit number (permit_num), County (county), Applicant
(app), and Route Name (route_nam) - to name a few. If I wanted to
search for the permit_num, my SEARCH would call that permit number.
But what if the user didn't have a specific piece of information. I
have 7 counties I deal with. What if the user new the permit was in
Richland county, but didn't know anything else. There could be 10
different permits for that county. Or, more specifically, what if the
user only new it was Main St. There could be 50 different
possibilities.

If I go into the database myself, I can do an Edit, Find and type in a
wild card name like "main", click Find and then scroll through the
possibilities. I want to be able to do this through a VBA macro. I
just don't know how to go about doing it in the most efficient way.

database name: Permit.Tracker
table name: permit_info

typical ADODB line:
' connect to the Access database
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=Z:\COMMON FILES\Encroachment Permits
\Permit.Tracker\Database\Permit.Tracker.mdb;"

typical recordset search line looking for one piece of info:
str = "SELECT permit_num FROM permit_info WHERE county = '" & sCounty
& "'"
rs.Open str, cn, adOpenKeyset, adLockOptimistic


Any ideas? Anyone up for the challenge?

Thanks in advance.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Two search category & two search terms avk Excel Discussion (Misc queries) 1 June 2nd 10 01:25 PM
searching a large database with a long list of search terms [email protected] Excel Discussion (Misc queries) 34 January 10th 06 06:23 AM
searching a large database with a long list of search terms [email protected] Excel Programming 32 January 10th 06 06:23 AM
search a string withing a string : find / search hangs itarnak[_9_] Excel Programming 4 October 24th 05 03:19 PM
Excel function to search and access database problem Brian K. Sheperd Excel Programming 0 April 20th 05 08:42 PM


All times are GMT +1. The time now is 03:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"