Comparing two tables and then updating one table. 
Author Message
 Comparing two tables and then updating one table.

If anybody can help me with the following I would greatly appreciate it.
I have been tasked to move data that has been downloaded from a mainframe
into a table and to add any new records and then update the existing records
two fields. Unfortunately the database was set up with a primary field based
on an autonumberso that is causing me some headaches.

I can successfully import the comma delimited data into a transition table -
ztAccountCodes.
I then want to check for any new records against table - tblAccountCodes
(five fields Account Codes, Cost Centre, Description, Expenditure and
Commitment. my table ztAccountCodes has a primary field based on Account
Codes + Cost Centre (these are a unique combination in both tables.

I have tried creating recordsets and dynaset without success. Any hints
would be greatly appreciated.

Regards Phill



Mon, 11 Mar 2002 03:00:00 GMT  
 Comparing two tables and then updating one table.
I think there is a none VB code way to do what you want.  Use an Action
Query.  Create a select query to view the information that you want to
add.  In other words, if you want it to compare what records are new
from one table, to another, put query criteria that shows only those
records that do not equal certain fields in another table.  As far as
action queries go, you can create a Make Table query that would make a
Table with the information you want, or you can use and Update Query,
or Append Query, definitions for both of these are in the help files.
Tell you the truth, I actually took a basic Access class a few weeks
ago, even though I have already learned how to use VB code on my own,
and I got a lot out of it just with how queries work. And the nifty
trick, which I didn't find out in the class, but on my own, is that you
can create a query to modify, sort, or delete information as you want,
and then change it to SQL view, and use that SQL in code.  This way you
can have the SQL in code modified by the code itself to do what you
want.  (I don't like to modify queries from code, I think it is easier
to just modify SQL and run the SQL.)

Crying Wolf



Quote:
> If anybody can help me with the following I would greatly appreciate
it.
> I have been tasked to move data that has been downloaded from a
mainframe
> into a table and to add any new records and then update the existing
records
> two fields. Unfortunately the database was set up with a primary
field based
> on an autonumberso that is causing me some headaches.

> I can successfully import the comma delimited data into a transition
table -
> ztAccountCodes.
> I then want to check for any new records against table -
tblAccountCodes
> (five fields Account Codes, Cost Centre, Description, Expenditure and
> Commitment. my table ztAccountCodes has a primary field based on
Account
> Codes + Cost Centre (these are a unique combination in both tables.

> I have tried creating recordsets and dynaset without success. Any
hints
> would be greatly appreciated.

> Regards Phill

--
He who learns but does not think is lost, he who thinks but does not lea

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Mon, 11 Mar 2002 03:00:00 GMT  
 Comparing two tables and then updating one table.
I am doing something like this....
Once the two tables exist with the same unique key

Step 1
Run an append query that contains the two tables linked on the key fields
and with the join properties set to
include all records from ztAccountCodes and only those that match in
tblAccountCodes with Criteria on AccountCodes from tblAccountCodes set to
isnull.

Step2
Run an update query containing both tables linked on the key fields with the
join properties set to include all from ztAccountCodes and only those that
match in the tblAccountCodes. Update the fields in tblAccountCodes with the
values from ztAccountCodes.

Quote:

>If anybody can help me with the following I would greatly appreciate it.
>I have been tasked to move data that has been downloaded from a mainframe
>into a table and to add any new records and then update the existing
records
>two fields. Unfortunately the database was set up with a primary field
based
>on an autonumberso that is causing me some headaches.

>I can successfully import the comma delimited data into a transition
table -
>ztAccountCodes.
>I then want to check for any new records against table - tblAccountCodes
>(five fields Account Codes, Cost Centre, Description, Expenditure and
>Commitment. my table ztAccountCodes has a primary field based on Account
>Codes + Cost Centre (these are a unique combination in both tables.

>I have tried creating recordsets and dynaset without success. Any hints
>would be greatly appreciated.

>Regards Phill



Mon, 11 Mar 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Create one table from 10 tables in two files

2. comparing data in specific fields from two tables ???

3. Comparing Two Access Tables?

4. Key field violation when comparing two tables

5. comparing two tables

6. Comparing Two Tables

7. Compare two access databases, size of tables

8. SQL - Join one table in one destination to another table in another destination (DBF)

9. comparing and updating tables

10. how to use VB open two MSaccess tables in one form

11. Data Entry to two seperate tables from one control simultaneously

12. Two problems with copying tables from one database to another

 

 
Powered by phpBB® Forum Software