The purpose of the main form that I have created is to allow my fellow co-workers to be able to have one place where they can enter in the information about various complaints we get. We have three types of complaints, each having their own tables, of which one is a subform in my main form. The primary key of the table of the subform is entered in by the user. I haven't found a way to have that primary key be added to the record that is produced for that entry. I am working with MS Access 2007 and the only code that came close to doing what I wanted was:
Private Sub Booking_Reference_Number_Exit(Cancel As Integer)
If Not IsNull(Form![Booking Reference Number]!PK_Booking_Ref_Number) Then
Dim mydb As Database
Dim rst As DAO.Recordset
Set mydb = CurrentDb()
Set rst = mydb.OpenRecordset("Incident_Report")
rst.AddNew
rst![FK_Booking_Ref_Number] = Form![Booking Reference Number]!PK_Booking_Ref_Number
rst.Update
Set rst = Nothing
Set mydb = Nothing
End If
End Sub
Thank you for your help.