Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy value from one table to another table dynamically

Status
Not open for further replies.

allen23

Technical User
Jan 9, 2003
1
US
I have two tables both with primary key "Asset_Number"

The 1st table name is "Assets", The second table name is "Devices".

"Assets" has just the "Asset_Number" field.

"Devices" has "Asset_Number" as well along with other fields.

What I need to have happen is, when a user inputs data into the "Asset_Number" field in "Devices", I need that same value to be added in "Asset_Number" in the "Assets" table.

Anyone's help is greatly appreciated.
 
Create a form based on your devices table. Set the AfterUpdate property of the Asset_Number field in the form to be an update query that updates the corresponding field in the Assets table. You will need to make sure that they can't create duplicate records, though
Hope that helps All help greatly appreciated
 
Here's a possible solution:
Open the "Assets" table as a recordset and load the contents into an array. When someone enters a value in the 'Assets' field of the "Devices" table, check to see if this value is contained in the array (I'd try keying this check on the 'LostFocus' event of the textbox into which the asset number is being entered). If it is, no action. If it's not, add the entry into both the recordset 'AddNew' and the array (but don't forget to do an 'Update' on the recordset to update the table with the new asset entry).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top