View Full Version : Update and Append Queries


Tim Payton
11-14-2009, 01:26 AM
I would like to have Access check a table and if the client name exists, then run an Update query and if it dosen't exist then run an Append query.



I have a table (clients)
When clients register I receive the information in an linked Excel spreadsheet. This spreadsheet may contain a combination of new and existing clients.
I understand how to write append queries.
I have very little experience with writing code. I have had some limited luck with modifying other people's code but if the following can be done through queries I would be very happy.

I'd appreaciate any information or sugestions about where to start finding the solution to this problem.

Thank you,

Tim

GalaxiomAtHome
11-14-2009, 02:39 AM
Good news. No code required. Just run both queries.

Use an inner join between the import and the current table for the Update query.

Use an outer join between the import and the current table for the Append query.
The outer join will be "show all the records from the import table etc" and critera Null on the current table.

LPurvis
11-14-2009, 05:06 AM
You shouldn't even need to run both queries.
A single Update should suffice. Have a look at this (http://www.access-programmers.co.uk/forums/showthread.php?t=180256) thread.

Cheers.

Tim Payton
11-14-2009, 07:06 AM
Thank you both for the information - I will play with this soon.

This forum has many wonderful and helpful people - thank you!



t

LPurvis
11-14-2009, 07:21 AM
I suppose if the linked spreadsheet results in ReadOnly data then the Update will present a problem (all parts of a query must be updatable to maintain updatability in the query).

See how you go.