Here's the SQL. Note that the table and field names are
not exactly the same as the ones I earlier mentioned (I
had simplified them for my example).
SELECT Left([Companies in Redmond Territory].[Company
Name],5) AS MatchMe
FROM [Companies in Redmond Territory] INNER JOIN [Current
Clients] ON [Companies in Redmond Territory].[Company
Name] = [Current Clients].Company
WHERE (((Left([Companies in Redmond Territory].[Company
Name],5))=Left([Current Clients].[Company],5)));
Thanks again for your help,
Dave
-----Original Message-----
Post the SQL of the query. Open the query in design
view, change to SQL view
(see toolbar icon on top left), copy the entire text
that you'll see there,
and post it here.
--
Ken Snell
<MS ACCESS MVP>
"Dave Redmond" <
[email protected]>
wrote in message
Gary and Ken,
Thanks for the help.
However, it looks like that expression is still
returning
only fields that match exactly.
If one field has "Microsoft Inc." and the other field
has "Microsoft Corp.", it's not catching the match. My
idea was that by focusing on the first 5 characters,
the
idea query would see that both fields start
with "Micro"
and would pull that record.
What do you think?
Thanks,
Dave Redmond
-----Original Message-----
Gary is correct.
--
Ken Snell
<MS ACCESS MVP>
message
Hi Dave,
PMFBI
you only need one column
Field: MatchMe: Left([Current Clients].[Company
1],5)
Table:
Sort: N/A
Show: unchecked
Criteria: Left([Potential Clients].[Company 2],5)
Fred and Ken,
Thanks for your help. Here's the Where clause.
Query in Design View. I dragged two fields, one
from
each
table, down to the lower grid.
FIRST BOX:
Field: Company 1
Table: Current Clients
Sort: N/A
Show: checked
Criteria: Left([Current Clients]![Company 1],5)
SECOND BOX:
Field: Company 2
Table: Potential Clients
Sort: N/A
Show: checked
Criteria: Left([Potential Clients]![Company 2],5)
Ken, is this what you mean by using "the Left
function on
both of the fields that you're comparing"?
Any help would be appreciated.
Thanks,
Dave Redmond
-----Original Message-----
Van,
I tried your suggestion. For some reason, the
Left
()
function only returns company names that have
less
than 5
characters total.
For example, it returned a match between "TSI"
and "TSI,"
but it did not return a match
between "Microsoft"
and "Microsoft."
How can I improve this function to return
company
names
containing the same first 5 characters but
which
have
longer company names?
Thanks,
Dave
-----Original Message-----
You can use the Left() function to truncate the
Field
values before
comparing them. For example:
Left([YourField], 5) will truncate your Field
values
to
the first 5
characters.
--
HTH
Van T. Dinh
MVP (Access)
"Dave Redmond"
<
[email protected]>
wrote in message
[email protected]...
I'm sure there's a simple answer to this
question.
I'm
new to Access.
I have 2 tables, each with a column
titled "Company
Name." I would like to use a query to compare
the two
columns and find matches.
However, I only want to compare the first 5
letters
of
each company name, because I know that
companies may
be
spelled a little differently at the end.
For example, "Microsoft" might appear in one
table
and "Microsoft, Inc." might appear in another
table.
If I
force the query to only return exact names, I
won't
be
able to catch this match.
How do I tell the query to compare only the
first 5
letters of the fields in each column?
Many thanks,
Dave Redmond
.
Instead of having us play 20 questions, why don't
you
copy and paste
the exact Where clause you are using.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
.
.