I am getting an error trying to put a record in a child table. 3022. I get the Parent records autonumber from a listbox selection of the parent record.
I try to put the parent ID1 (Autonumber) into the foreign key of the child table but it errors?
Dim rs As DAO.Recordset
Dim db As Database
Set db = CurrentDb()
Set rs = db.OpenRecordset("Contacts", dbOpenDynaset)
rs.AddNew
rs.Fields(0) = Val(Me.List7.Column(0))(foreign key in Child table
rs.Fields(2) = Trim(Me.TT1) ' First Name
rs.Fields(3) = Trim(Me.TT2) ' Last Name
rs.Fields(6) = Trim(Me.TT3) ' Job Title
rs.Fields(5) = Trim(Me.TT4) ' Business Phone
rs.Fields(8) = Trim(Me.TT5) ' Home Phone
rs.Fields(7) = Trim(Me.TT6) ' Mobile
rs.Fields(4) = Trim(Me.TT7) ' Email
rs.Fields(9) = Trim(Me.TT8) ' Fax
rs.Update
Appreciate any ideas. Using Access 2000 (clients) and have been plagued with "Error Accessing files, Network connection may have been lost" Yet all patches done, SP3 ETC. Driving me mad Thanks
I try to put the parent ID1 (Autonumber) into the foreign key of the child table but it errors?
Dim rs As DAO.Recordset
Dim db As Database
Set db = CurrentDb()
Set rs = db.OpenRecordset("Contacts", dbOpenDynaset)
rs.AddNew
rs.Fields(0) = Val(Me.List7.Column(0))(foreign key in Child table
rs.Fields(2) = Trim(Me.TT1) ' First Name
rs.Fields(3) = Trim(Me.TT2) ' Last Name
rs.Fields(6) = Trim(Me.TT3) ' Job Title
rs.Fields(5) = Trim(Me.TT4) ' Business Phone
rs.Fields(8) = Trim(Me.TT5) ' Home Phone
rs.Fields(7) = Trim(Me.TT6) ' Mobile
rs.Fields(4) = Trim(Me.TT7) ' Email
rs.Fields(9) = Trim(Me.TT8) ' Fax
rs.Update
Appreciate any ideas. Using Access 2000 (clients) and have been plagued with "Error Accessing files, Network connection may have been lost" Yet all patches done, SP3 ETC. Driving me mad Thanks