Results 1 to 3 of 3
  1. #1
    tanyalee123 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2013
    Posts
    51

    Question Can someone tell me what's wrong with my update query?

    Monthly I have to append new patients to my DB. That all goes as planned, but I also want to update any changes in the patient's address, phone, last name, etc, so I created an update query to be run after the append query. However, when I run the query in my test DB, it wants to make an update to the DB of every record that has a corresponding record in the spreadsheet (HP) that I'm using to run the update. I know for sure that this can't be right - everyone can't have had an update to their demographic data. I don't understand why it wants to update every record...



    Hopefully you can see the image.Click image for larger version. 

Name:	query.jpg 
Views:	9 
Size:	47.5 KB 
ID:	18837

    Here is the SQL:
    UPDATE HP INNER JOIN PatientInfo ON HP.UniqueID = PatientInfo.UniqueID SET PatientInfo.PropertyName = [HP].[PropertyName], PatientInfo.Plan = [HP].[Plan], PatientInfo.LastName = [HP].[LastName], PatientInfo.Address = [HP].[Address], PatientInfo.City = [HP].[City], PatientInfo.State = [HP].[State], PatientInfo.Zip = [HP].[Zip], PatientInfo.Phone = [HP].[Phone], PatientInfo.Lang = [HP].[Lang];

    Thanks!!
    Tanya

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    The query will only update those records in PatientInfo that have a match in HP.

    Shouldn't really matter if it runs against every record. If their data is unchanged then the update will just update with the same data. If you do want to limit the update then need filter criteria.

    HP is a linked spreadsheet or is it a native table that records are imported into from spreadsheet? Why have another table for the PatientInfo?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    tanyalee123 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2013
    Posts
    51
    Thank you, it was freaking me out that it was showing that many updates. I'm fine with that.

    HP is a linked spreadsheet that I get from our Analytics department monthly, but it doesn't contain every record in the database. When a patient's health insurance terminates, they won't be on the spreadsheet anymore, so I use the spreadsheet to add new patients and to update their health insurance term date.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Whats wrong with my query
    By Kirtap in forum Queries
    Replies: 5
    Last Post: 10-01-2013, 10:31 AM
  2. What's wrong with this Query?
    By Richie27 in forum Queries
    Replies: 3
    Last Post: 05-25-2012, 08:25 AM
  3. Please help: what is wrong with this query?
    By drhassan in forum Queries
    Replies: 4
    Last Post: 05-24-2012, 05:15 PM
  4. What's wrong with my query?
    By Grek in forum Queries
    Replies: 2
    Last Post: 10-31-2011, 12:12 PM
  5. What's wrong with this query?
    By jsoldi in forum Queries
    Replies: 2
    Last Post: 10-11-2010, 07:45 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums