Linkined fields on multiple tables

vericlese

New member
Local time
Today, 03:52
Joined
Jan 14, 2003
Messages
6
I have a databse with multiple tables and forms and would like to have information input in one form/table, auto update the dame feild type on another form/table. can this be done?

vericlese
 
Why do you want to enter duplicate data?
 
The reason i would like to have the data duplicate is because the field is a location field and when a peice of equipment is moved i would like it to update a location fields where that equipment is indexed.
 
Assuming you have the piece of equipment stored somewhere on your form..

Code:
  Dim db As DAO.Database, rst As DAO.Recordset, equipID as Integer

 'first, get the Primary Key of the record you are looking for
 curEquip = DLookup("[equipID]", "tblEquip", "[EquipPiece] = '" & _
 Forms!frmYourForm!txtEuipPiece & "'")  
 
 Set db = CurrentDb
 Set rst = db.OpenRecordset("tblEquip")
 
 With rst
     ' Set current index.
     rst.Index = "equipID"   'Primary Key field from table

    ' Locate record.
     rst.Seek "=", equipID  'move to the record in the tblEquip
     .Edit     
               'Reset the location field for your desired record
              !Location = Forms!frmYourForm!Location      
     .Update
     
 End With
 Set rst = Nothing
 Set db = Nothing

Good Luck..
 

Users who are viewing this thread

Back
Top Bottom