Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Union Queries Update Queries
Melissa Donnelly 
    
3 years ago
I've individualized queries per field to review changes/ differences between my table and linked table. I then created a union query so that I get all those query results in one spot. I see that you can't make a union update query, so how can I run all those updates at once without having to make million field update queries. I have tried playing with criteria with the "Or" row <>[linked.Tbl]![fieldname] but I think I'm getting the expression wrong.
Melissa Donnelly OP  @Reply  
    
3 years ago
I'm getting closer to resolving my problems, but would appreciate input/ guidance on what I need to watch.

I have managed to get the Query Criteria input so that it finds all changed data, but when I try to update it, it gives me error: "cannot update 'expression'; field not updatable". I can click on "Datasheet View" and I can see all the changed data I want to update.

I was trying to do this query using a linked table, so I created a local copy of the table (Something about some kind of MS Lawsuit). I ran the update, no more error message, and it claimed to update. I can no longer see any results in "Datasheet View". Only thing is, I do not know where it updated. I looked at my access table [Donor_TBL] and the changed information wasn't incorporated, but the update thinks it's done its job.

I tried this pretty much exact thing, but with an Append Query, and all it did was create New Records at the bottom with new primary key data, so that wasn't what I wanted. I wanted that "new data" to go into empty cells of existing records.
Some of the fields wouldn't show up unless I used "Null" vocabulary vs others only showed up when I specified different than <>[tbl].. Kind of annoying because I attempted to disable ZSL, but whatever I got it working.

Here is the SQL code:

UPDATE DonorSheet_TBL LEFT JOIN Donor_TBL ON DonorSheet_TBL.Keyline = Donor_TBL.Keyline SET DonorSheet_TBL.Email = [Donor_TBL]![EmailAddress], DonorSheet_TBL.[First Name] = [Donor_TBL]![FirstName], DonorSheet_TBL.[Last Name] = [Donor_TBL]![LastName], DonorSheet_TBL.[Notes/Help] = [Donor_TBL]![Notes], DonorSheet_TBL.[Lifetime Contribution Total] = [Donor_TBL]![LifeTimeContribution], Donor_TBL.DateUpdated = Now()
WHERE (((DonorSheet_TBL.Email) Is Not Null) AND ((Donor_TBL.EmailAddress) Is Null)) OR (((DonorSheet_TBL.[First Name]) Is Not Null) AND ((Donor_TBL.FirstName)<>[DonorSheet_TBL]![First Name])) OR (((DonorSheet_TBL.[Last Name]) Is Not Null) AND ((Donor_TBL.LastName)<>[DonorSheet_TBL]![Last Name])) OR (((DonorSheet_TBL.[Notes/Help]) Is Not Null) AND ((Donor_TBL.Notes)<>[DonorSheet_TBL]![Notes/Help])) OR (((DonorSheet_TBL.[Lifetime Contribution Total])<>[Donor_TBL]![LifeTimeContribution]));


This was the original SQL code for the linked TBL. Again, when I hit "Datasheet View" I see what needs to be changed, but get error message: "cannot update 'expression'; field not updatable"

UPDATE DonorSheet_TLU LEFT JOIN Donor_TBL ON DonorSheet_TLU.Keyline = Donor_TBL.Keyline SET DonorSheet_TLU.Email = [Donor_TBL]![EmailAddress], DonorSheet_TLU.[First Name] = [Donor_TBL]![FirstName], DonorSheet_TLU.[Last Name] = [Donor_TBL]![LastName], DonorSheet_TLU.[Notes/Help] = [Donor_TBL]![Notes], DonorSheet_TLU.[Lifetime Contribution Total] = [Donor_TBL]![LifeTimeContribution], Donor_TBL.DateUpdated = Now()
WHERE (((DonorSheet_TLU.Email) Is Not Null) AND ((Donor_TBL.EmailAddress) Is Null)) OR (((DonorSheet_TLU.[First Name]) Is Not Null) AND ((Donor_TBL.FirstName)<>[DonorSheet_TLU]![First Name])) OR (((DonorSheet_TLU.[Last Name]) Is Not Null) AND ((Donor_TBL.LastName)<>[DonorSheet_TLU]![Last Name])) OR (((DonorSheet_TLU.[Notes/Help]) Is Not Null) AND ((Donor_TBL.Notes)<>[DonorSheet_TLU]![Notes/Help])) OR (((DonorSheet_TLU.[Lifetime Contribution Total])<>[Donor_TBL]![LifeTimeContribution]));
Kevin Yip  @Reply  
     
3 years ago
When you have tables joined together, their data may not be updateable.  Update to an individual table instead, and it will always be updateable.  E.g.:

     UPDATE TableName SET A=B, C=D, ... WHERE ...

If you need to update Table A with Table B's data, look up the data in Table B with DLookup(), then update Table A with it.  You need VBA to do this.  E.g.:

     a = DLookup("[A]", "[TableB]", "X = Y")
     DoCmd.RunSQL "UPDATE TableA SET A = " & a & " WHERE X = Y"

If you have lots of records in Table A to be updated, use a "Recordset loop" to do it.

So you need to get some training on VBA and Recordset if you haven't already.
Melissa Donnelly OP  @Reply  
    
3 years ago
hmm, i'm not sure whether this is what i'm after. essentially, i'm trying to duplicate my linked table (raw data) into my database, and assign a primary key, so that i can form relationships between donor table, transactions table, donations table, and communication table. all of those tables are linked to their own csv and all have "keyline" field as unique customer numbers. I thought about just running queries off of those table directly, but I can't assign a primary key to a linked table.

This is why i'm trying to import and assign. I do not want to edit data in access. all the raw data is stored and entered in an online database called "kindful." i'm trying to make sure that any changes made in kindful get updated into access when a new csv becomes available. This is why i've focused my attention on the "Import New and Changed Records in Microsoft Access. Update Pricing from Vendor Excel Spreadsheet" video. Kindful right now isn't great for tracking statistics or designing queries. Though I did watch a video about overly complicated queries making things non-updateable which I think is part of my problem. I'm not working with forms, so don't really know how to apply that to my situation.

what videos should i start wtih regarding VBA/Recordset/ Dlook-up?
Kevin Yip  @Reply  
     
3 years ago
If your Access table's primary key is an autonumber field, then the primary keys are automatically created when you put your linked table's data into it.  So you won't have to worry about assigning PKs to a linked table.

Is your "Kindful" database an SQL Server database?  Tables linked from SQL Server can work quite seamlessly with Access.  Access will see them as just like other tables.

The queries in your first post won't work even if you have all your tables in Access and don't have any linked tables, because the queries just aren't updateable.  So you need to consider my suggestion anyhow, and update table by table.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/16/2026 11:23:08 AM. PLT: 0s