pdvsa
asked on
Syntax error - Insert records
Experts, I keep getting a syntax on the insert line. Do you see where I have made a mistake? It might be something to do with the # placement on the date field. the VBA is on a button on the parent and the records I am inserting are on a subform.
Private Sub cmdInsertRecords_Click()
Dim db As DAO.Database, intMyValue As Date, intMyValue2 As Integer
intMyValue = Me.DrawDate
intMyValue2 = Me.Currency
Set db = CurrentDb
db.Execute "Insert into tblDraws_Details1 (ValueDate, Currency) VALUES (#" & intMyValue & "#," & intMyValue2 & ")"
Set db = Nothing
End sub
Private Sub cmdInsertRecords_Click()
Dim db As DAO.Database, intMyValue As Date, intMyValue2 As Integer
intMyValue = Me.DrawDate
intMyValue2 = Me.Currency
Set db = CurrentDb
db.Execute "Insert into tblDraws_Details1 (ValueDate, Currency) VALUES (#" & intMyValue & "#," & intMyValue2 & ")"
Set db = Nothing
End sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER