Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default MS Query: Search Criteria "Similar to" Cell Reference

Does anyone know if it is possible to perform a query based on the begining
few letters of a word in a cell reference?

Background: I have 2 databases with client identification numbers. In the
first (my excel workbook), they look like "12345", in the second databse (ms
access), they begin with the same few digits, but may vary after the first 4
characters (like "1234567-R" or "1234--P"). Currently, my query runs off a
cell reference to the 'ms access formated client id' which has to be
mannually entered into the worksheet after you look it up in access.
Unfortunately, the id's can not be changed in either database, and I really
dont want to harcode an index due to the constant addition/subtraction of
id's.

I would like to just use a reference to the 'excel formated client id' to
perform the access query, but because the id's dont match exactly in both
databases, it will not work. Is there a way to use the criteria (such as
"like") when I am using a cell reference to perform a query? For example i
would like my criteria to be the first 4 characters of cell b1, with the
remainder characters wildcards ...Like '=(left, b1, 4)%'???

I've had no luck thus far... let me know if any one has a work around.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default MS Query: Search Criteria "Similar to" Cell Reference

Dim SQL as string
SQL = "select * from tablename t where t.columnname like '" & _
Left(activesheet.range("B1").value, 4) & "*' "


Tim

"ToddEZ" wrote in message
...
Does anyone know if it is possible to perform a query based on the
begining
few letters of a word in a cell reference?

Background: I have 2 databases with client identification numbers. In
the
first (my excel workbook), they look like "12345", in the second databse
(ms
access), they begin with the same few digits, but may vary after the first
4
characters (like "1234567-R" or "1234--P"). Currently, my query runs off
a
cell reference to the 'ms access formated client id' which has to be
mannually entered into the worksheet after you look it up in access.
Unfortunately, the id's can not be changed in either database, and I
really
dont want to harcode an index due to the constant addition/subtraction of
id's.

I would like to just use a reference to the 'excel formated client id' to
perform the access query, but because the id's dont match exactly in both
databases, it will not work. Is there a way to use the criteria (such as
"like") when I am using a cell reference to perform a query? For example
i
would like my criteria to be the first 4 characters of cell b1, with the
remainder characters wildcards ...Like '=(left, b1, 4)%'???

I've had no luck thus far... let me know if any one has a work around.



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
"search" a different sheet with multiple criteria Art Excel Worksheet Functions 2 March 10th 10 08:11 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How to write parameter query with "or is null" criteria Vincent Alliance New Users to Excel 0 April 8th 06 02:55 AM
Excel VBA - go to worksheet "name" based on a cell reference ="Name" james007 Excel Programming 2 July 8th 04 11:04 PM
How do I show Auto-Filter "Search" Criteria on Sheet1? golf4 Excel Programming 4 May 25th 04 05:45 AM


All times are GMT +1. The time now is 07:09 AM.

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

About Us

"It's about Microsoft Excel"