Results 1 to 8 of 8
  1. #1
    Arroyo's Avatar
    Arroyo is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    9

    field value dependency

    hello,

    I have table "items " and fields "status" and "person_id" in it, among others.


    Status can be "place1" , "place2" and "warehouse"
    person_id is foreign key form the person related table
    I would like to make, if "person_id" is blank then "status" is changed to "warehouse"

  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,772
    And when would you like this to happen? Why is person_id blank? Could have DefaultValue property of status set to "warehouse". Also code behind person_id could set the "warehouse" status if value deleted.
    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
    Arroyo's Avatar
    Arroyo is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    9
    default value would only help for new items. when item goes to warehouse i delete person_id in items table and change status to warehouse. then item is not showing in the report that connect person and item and it shows in the report that shows items on warehouse. i would like to change (delete) only 1 field, person_id and then status change automatically.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    I did suggest code behind person_id control - probably AfterUpdate event.

    But I really don't understand your data structure and processes well enough to be more specific.
    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.

  5. #5
    Arroyo's Avatar
    Arroyo is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    9
    how can i change automatically value in 1 field if another one is changed. for example, if table have fields item, person id, and status. if person_id is blank then status should changed to warehouse.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    As I said set DefaultValue to use 'warehouse' for new record.

    Then code in person_id textbox AfterUpdate event can set value in the status field. VBA example:

    If IsNull(Me.person_id) Then
    Me.status = "warehouse"
    ElseIf Me.status = "warehouse" Then
    Me.status = Null
    End If
    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.

  7. #7
    Arroyo's Avatar
    Arroyo is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    9
    thx but i never used VBA code...

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Macro coding does have a SetValue method.

    Google it, you should find info.

    I never use macros.
    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.

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

Similar Threads

  1. remove object dependency
    By Jen0dorf in forum Access
    Replies: 1
    Last Post: 11-03-2015, 08:33 AM
  2. Simple dependency question
    By shoelesscraig in forum Access
    Replies: 19
    Last Post: 08-12-2015, 12:59 PM
  3. Inherit from dependency.
    By Flashbond in forum Access
    Replies: 2
    Last Post: 08-13-2013, 04:59 AM
  4. Fixing dependency...
    By Uniden in forum Forms
    Replies: 1
    Last Post: 10-08-2011, 02:42 AM
  5. Missing Dependency Question
    By usmcgrunt in forum Access
    Replies: 2
    Last Post: 09-07-2010, 11:55 AM

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