P
Panagiotis Marantos
hello
i have the following code on the after insert event in a subform.
i need when a user entere a new record the system to go and add a new record
in the two tables seen below with just the id transferred.
however this does not happen at the moment.
anybody can shed some light into this?
Private Sub Form_AfterInsert()
Dim rec, rec2 As Recordset
Dim la As String
Dim conn, conn1 As Connection
Dim patient As Integer
Set rec = New ADODB.Recordset
Set rec2 = New ADODB.Recordset
Set conn = CurrentProject.Connection
patient = [Forms]![Data Entry V2]![Patient Details]!PatientID.value
rec.Open "[3 6 Monthly reviews]", conn, adOpenDynamic,
adLockBatchOptimistic, adCmdTable
rec.AddNew
rec.Fields(1) = patient
rec.Update
rec.Close
rec2.Open "[Annual Reviews]", conn, adOpenDynamic, adLockBatchOptimistic,
adCmdTable
rec2.AddNew
rec2.Fields(1) = patient
rec2.Update
rec2.Close
End Sub
i have the following code on the after insert event in a subform.
i need when a user entere a new record the system to go and add a new record
in the two tables seen below with just the id transferred.
however this does not happen at the moment.
anybody can shed some light into this?
Private Sub Form_AfterInsert()
Dim rec, rec2 As Recordset
Dim la As String
Dim conn, conn1 As Connection
Dim patient As Integer
Set rec = New ADODB.Recordset
Set rec2 = New ADODB.Recordset
Set conn = CurrentProject.Connection
patient = [Forms]![Data Entry V2]![Patient Details]!PatientID.value
rec.Open "[3 6 Monthly reviews]", conn, adOpenDynamic,
adLockBatchOptimistic, adCmdTable
rec.AddNew
rec.Fields(1) = patient
rec.Update
rec.Close
rec2.Open "[Annual Reviews]", conn, adOpenDynamic, adLockBatchOptimistic,
adCmdTable
rec2.AddNew
rec2.Fields(1) = patient
rec2.Update
rec2.Close
End Sub