Importing Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to import information from another table but the problem is that
the information that it needs to decide if it needs to be imported does not
match completely. Any ideas on how to fix it?
 
Yes - but none that are any use without examples of what you want to
match with what.
 
Example:
In my Table1 the information looks like: 123456

In my Information the information looks like: 123456 MR
 
It sounds as if you want to match up records in Table1 and Information
on the basis of the number in the first field (e.g. 123456), and update
a field in Table1 with the value of the second field in Information
(e.g. "MR").

If that's right, start off by making sure you have a backup copy of your
database in case of accidents. Then create an ordinary SELECT query that
joins the two tables on the first field and returns the first 2 fields
in both tables. You haven't mentioned the field names, so I'll call them
Field1 and Field2.

Get this working before you go further. In SQL view it should look
something like this:

SELECT Table1.Field1, Information.Field1, Table1.Field2,
Information.Field2
FROM Table1 INNER JOIN Information
ON Table1.Field1 = Information.Field2;

If Table1 already has some values in the second field (i.e. you don't
want to replace all the existing values in that field with imported
ones), add a criterion (back in Design view) of
Is Null
to Table1.Field2

When the query returns only the records in Table1 you want to update,
each with the corresponding values from Information, you're ready for
the next step.

In Design View, use the Query menu to turn it into an Update query.
Delete all the fields except the one you want to update (Table1.Field2),
and in the Update To cell for this field put
[Information].[Field2]

That should do the trick. But be sure you have a backup copy of the
database in case we've misunderstood each other!
 
Back
Top