Results 1 to 3 of 3
  1. #1
    celito is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    10

    Updating Field in one Table Based on Condition Using Two Tables

    I have two tables, Activity and Space. Space contains two fields, Number and Status. The default value of Status is "Available". The table Activity also contains a Field called Number, which is related to the same field in the table Space. How can the value in Status (table Space) change to "Closed" once the fields Number in both tables match (meaning the number in Space has been chosen in the Number drop down list in the table Activity)?



    Any help will be greatly appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    If you are entering data directly in the table, you can manually enter the value or run an Access UPDATE query.

    If you are entering data through a form you can use code to update the value. Is the Status field included in the form's RecordSource? Code in AfterUpdate event of the Number combobox could be Me!Status = "Closed". If the Status field is not in the form's RecordSource, can execute an SQL UPDATE statement in code.
    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
    celito is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    10
    Thanks June 7. I'm entering data through a form. The Status field is in the Space form, which I want to change in value to "Closed" from the default value "Available" as soon as the Number combo box in the Activity form is updated. Where should I put the code? In the Number field of Activity form I suppose. What is the correct expression, syntax? Thanks for all the help.

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

Similar Threads

  1. Replies: 6
    Last Post: 06-08-2011, 05:00 PM
  2. Printing multiple reports at once based on condition
    By justinwright in forum Reports
    Replies: 24
    Last Post: 04-13-2011, 01:40 PM
  3. Replies: 1
    Last Post: 11-04-2010, 12:57 PM
  4. Update 2 fields based on where condition.
    By Confused in forum Access
    Replies: 2
    Last Post: 11-19-2009, 05:21 PM
  5. Updating Table field from Form
    By Kunuk in forum Access
    Replies: 0
    Last Post: 02-26-2009, 11:41 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