Results 1 to 4 of 4
  1. #1
    SeaTigr is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Nov 2011
    Location
    U.S.A.
    Posts
    38

    Update Query Using A Form

    Good day, all.

    I'm designing an inventory database. At the moment, I have a form where users can enter an identifying piece of information about a piece of equipment (serial #, service tag #, etc.) and run a Select query. Another form shows the results of the query. I would like users to be able to utilize the results form to change information. As I understand things, this requires an Update query. Unfortunately, my Update query is updating all the records in the database. If I'm understanding correctly, this means my Criteria is not set correctly.

    Is my hypothesis about the Criteria being set incorrectly correct? And, if so, how should I set the Criteria to ensure the Update query only updates the one record set?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    It sure sounds correct, if all records are being updated.

    Review this info on UPDATE query.
    So either backup your table, and/or create a select query with CRITERIA to show only the records you intend to UPDATE.

    Then convert the Select query to an UPDATE query using the wizard.

    see http://www.techonthenet.com/sql/update.php
    and
    http://www.w3schools.com/sql/sql_update.asp

  3. #3
    SeaTigr is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Nov 2011
    Location
    U.S.A.
    Posts
    38
    Thanks for the links. Such a silly error - my Criteria and Update To entries were in the same column...but I wasn't trying to update the same field.

  4. #4
    SeaTigr is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Nov 2011
    Location
    U.S.A.
    Posts
    38
    Okay, now there's another interesting problem.

    So, the table being updated is the Equipment Table. The record is the System Name. The record stores a foreign key because the system names are stored in another table, Systems List.

    The Query Results Form, which users update the table with (not enter new pieces of equipment), has a combo box which shows the system names. Updates are saved to the Equipment Table.

    When I change the system name and run the Update query, the foreign key in the Equipment Table changes to the appropriate # of the new system. However, the record containing the name of the system being changed in the System List is being changed to the primary key number of the new system.

    So, if the current system name is X and I use the Update query to change it to Y, the foreign key stored in the Equipment Table is changed from X to Y. But the record in the System List containing the text 'X' is changed to the ID # for Y.

    How do I stop this?

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

Similar Threads

  1. Single Record Update Query from a Form
    By Steven.Allman in forum Access
    Replies: 0
    Last Post: 03-30-2011, 09:34 AM
  2. update query fon a filtered form HELP!
    By campanellisj in forum Queries
    Replies: 0
    Last Post: 11-12-2010, 09:08 AM
  3. Can update from query, but not from form?
    By Brian_45 in forum Forms
    Replies: 2
    Last Post: 10-19-2010, 08:22 PM
  4. Form doesn´t update with Query.
    By disturbedgod in forum Forms
    Replies: 10
    Last Post: 02-09-2010, 02:00 PM
  5. Update Query from Form
    By ste_pie87 in forum Queries
    Replies: 2
    Last Post: 04-26-2009, 07:22 PM

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