Results 1 to 3 of 3
  1. #1
    ephi is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    2

    Question How to save a record to 2 tables when a particular field is updated


    I have a basic asset management database (a single table and a form for adding assets). Every time an asset is issued to an employee, the original asset field is modified and the record is saved.Now I want to track asset movements. I want to be able to run a report or query on all the asset movements over a particular period of time or for a particular asset.


    I am a beginner in Access and so any suggestions you can give on how to handle this will be greatly appreciated.
    Thank you very much.
    Last edited by ephi; 02-11-2013 at 11:45 AM. Reason: for clarity

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    If you only have one table - assets - you won't be able to do this, because each time you issue an asset to someone, you will overwrite existing data.

    You are going to need another table to track the assets; at the very least, it will need fields for:

    Asset ID
    Employee ID
    Date Issued
    Date Returned

    You probably want to have another table, for employees.

    What you have is a good example of a many-to-many relationship - any one asset can be issued to many employees, and any one employee can be issued many assets.

    Any time you have a many-to-many relationship, you will need three tables.

    Just one question - the title of your post said "save a record to two tables" - do you have two? you only mentioned one.

    HTH

    John
    Last edited by John_G; 02-11-2013 at 03:28 PM. Reason: additional comment

  3. #3
    ephi is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2013
    Posts
    2
    Hi John,

    Thanks for your response. I was trying out a lot of things and as at the time of writing this, I have more than 1 table. I actually have 4: Assets, AssetMovements, Employees, Locations.
    Now here's how our asset issuance works: Every time an asset is issued to an employee, the values of 2 fields will have to be updated; the 'Assigned To' field and 'Location' field.

    Here's what I have done so far:
    I created 2 tables; Assets and AssetMovements. I also created the main Assets form and an Asset Movement form. The Asset Movement form is essentially a replica of the Assets form but it has the AssetMovements table as it's record source. I created a lookup in the AssetMovements table (AssetTag field) so a user can select an asset tag from a combo box and the details of that asset will be populated automatically into the rest of the fields on the form. The only editable fields on the form are the 'Location' and 'AssignedTo' field which refers to the employee.
    Right now, everything works fine, but the problem is that if I create a new record using the AssetMovements form and save it, the 'Location' field in the original record which resides in the 'Assets" table will not be updated. Same goes for the 'AssignedTo' field in the original record.

    Is there a way to update the main asset record in the Assets table whenever a new AssetMovement is created on that record?

    Thanks.

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

Similar Threads

  1. Replies: 8
    Last Post: 09-20-2012, 12:13 PM
  2. Replies: 34
    Last Post: 09-20-2012, 07:02 AM
  3. Save the updated data
    By ramindya in forum Access
    Replies: 4
    Last Post: 03-18-2012, 09:14 PM
  4. Save record to 2 tables on one click
    By chin1383 in forum Forms
    Replies: 1
    Last Post: 04-01-2011, 12:49 PM
  5. Force form not to save updated fields
    By Evgeny in forum Programming
    Replies: 2
    Last Post: 04-30-2010, 10:44 PM

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