D
dbl
Hi I have a form which when a new record is added adds the field CustomerID
Ref Number to 2 linked tables. Into fields CustomerID2 and CustomerID3
All worked well with no problems with the code below with 1 linked table.
Private Sub Form_AfterInsert()
CurrentProject.Connection.Execute "INSERT INTO tblTheftForm (CustomerID2)
VALUES (" & Me.Field143 & ")"
End Sub
But with 2 tables and the following code it runs into an error stating that
I have duplicate data and the first line of code is highlighted, this only
happens about 50% of the time.
the rest of the time it works fine.
Private Sub Form_AfterInsert()
CurrentProject.Connection.Execute "INSERT INTO tblTheftForm (CustomerID2)
VALUES (" & Me.Field143 & ")"
CurrentProject.Connection.Execute "INSERT INTO tblTelephoneChecklist2
(CustomerID3) VALUES (" & Me.Field143 & ")"
End Sub
I also have the following fields in the query that supports the form and all
the 3 tables are in this query.
CustomerID
CustomerID: CustomerID2
CustomerID: CustomerID3
Has anyone any ideas as to what I am doing wrong.
Thanks Bob
Ref Number to 2 linked tables. Into fields CustomerID2 and CustomerID3
All worked well with no problems with the code below with 1 linked table.
Private Sub Form_AfterInsert()
CurrentProject.Connection.Execute "INSERT INTO tblTheftForm (CustomerID2)
VALUES (" & Me.Field143 & ")"
End Sub
But with 2 tables and the following code it runs into an error stating that
I have duplicate data and the first line of code is highlighted, this only
happens about 50% of the time.
the rest of the time it works fine.
Private Sub Form_AfterInsert()
CurrentProject.Connection.Execute "INSERT INTO tblTheftForm (CustomerID2)
VALUES (" & Me.Field143 & ")"
CurrentProject.Connection.Execute "INSERT INTO tblTelephoneChecklist2
(CustomerID3) VALUES (" & Me.Field143 & ")"
End Sub
I also have the following fields in the query that supports the form and all
the 3 tables are in this query.
CustomerID
CustomerID: CustomerID2
CustomerID: CustomerID3
Has anyone any ideas as to what I am doing wrong.
Thanks Bob