Comparing fields

  • Thread starter Thread starter DL
  • Start date Start date
D

DL

I'd like to create a query that will compare a field from
one table to another and--if the data is closely related--
create a new table with the fields residing in the same
record.

I have a table with a field "LastName" and a table with a
field "NameImageFile". Here are some sample entries:

LastName NameImageFile
smith smith-j.jpg
smithe smithe-l.jpg
jones jones-l.jpg
jonesey jonesey-q.jpg
brown brown-b.jpg

Is there a way to do this simply, with with a VBA module?

Thanks for your help!

DL
 
Well, it could be done, but if may not be all that reliable. You could use an
SQL statement like the sample below. Note that this relies on NameImageFile
format always being in the format Name plus dash. UNTESTED SQL statements follow

SELECT Table1.LastName, Table2.NameImageFile
FROM Table2 INNER JOIN Table1
ON Table2.NameImageFile LIKE Table1.LastName & "-*"

You could then use this as the source of your make table query or try to do it
directly with a statement like:

SELECT LastName, NameImageFile INTO NewTable
FROM Table2 INNER JOIN Table1
 
John:

This worked quite nicely!

Thanks,

Doug
-----Original Message-----
Well, it could be done, but if may not be all that reliable. You could use an
SQL statement like the sample below. Note that this relies on NameImageFile
format always being in the format Name plus dash. UNTESTED SQL statements follow

SELECT Table1.LastName, Table2.NameImageFile
FROM Table2 INNER JOIN Table1
ON Table2.NameImageFile LIKE Table1.LastName & "-*"

You could then use this as the source of your make table query or try to do it
directly with a statement like:

SELECT LastName, NameImageFile INTO NewTable
FROM Table2 INNER JOIN Table1

.
 
Back
Top