View Full Version : SQL Insert Into


IanT
02-08-2006, 12:50 AM
Hi
I am using this code to append data to a table, the code appends once ok then if you try again there is a error saying it cannot append any records. Can anyone help!

Dim db As DAO.Database
Dim SQL As String

Dim strActivityType As String
Dim strNow As String
Dim strProdCode As String

Set db = CurrentDb

strActivityType = Forms!frmProducttree.txtType
strNow = Forms!frmProducttree.txtNow
strProdCode = Forms!frmProducttree.sfmGeneric.Form.[Product reference]

SQL = "INSERT INTO tblSale ( QuoteRef, BusinessType, ProductCode )" & _
"SELECT '" & strNow & "','" & strActivityType & "','" & strProdCode & "'"

DoCmd.RunSQL SQL