I am doing a project for work, and I am attempting to do a manual insert into a query. I have been beating my head trying to get it to work and thought maybe someone might have some insight into the problem.
I have a form that I am pulling all of the data from, I then put the information into variables, then I try to insert the variables into the query. I keep getting the blasted Syntax error on the Into Insert statement. Here is the code:
Dim db As DAO.Database
Dim sSQL As String
Dim varIN As String, varTran As String, varTP As String, varEF As Date, varNP As Currency, varSo As String, varPr As String, varCS As String, varCom As String, varOf As String, varFCTC As String, varTC As String, varLP As Currency, varDK As Date, varPN As String
varIN = Me.Insured_Name.value
varTran = Me.Transaction.value
varTP = Me.Type_of_Policy.value
varEF = Me.Effective_Date.value
varNP = Me.New_Premium.value
varSo = Me.Combo162.value
varPr = Me.Producer.value
varCS = Me.Combo224.value
varCom = Me.Memo.value
varOf = Me.Office.value
varFCTC = Me.Combo242.value
varTC = Me.Combo395.value
varLP = Me.Text261.value
varDK = Me.Text410.value
varPN = Me.Text425.value
Set db = CurrentDb
sSQL = "INSERT INTO Transactions Extended ([Insured Name], [Transaction],[Type of Policy], [Effective Date], [New Premium], [Source], [Producer], [CSR], [Comments], [Office], [From Company / To Company], [To Company], [Lost Premium], [Date Keyed], [Policy Number]) Values ("" & varIN & "","" & varTran & "", "" & varTP & "",#" & varEF & "#,"" & varNP & "","" & varSo & "","" & varPr & "","" & varCS & "","" & varCom & "","" & varOf & "","" & varFCTC & "","" & varTC & "","" & varLP & "",#" & varDK & "#,"" & varPN & "")"
db.Execute sSQL, dbFailOnError
If anyone sees anything glaring that I am missing let me know!
Thanks
~Joel