violentjay25
Registered User.
- Local time
- Today, 17:12
- Joined
- Feb 22, 2005
- Messages
- 30
I need help. I have a simple form with 1 combo box and 2 text boxes. The combo box is populating from tbl_Projects. I want to select a value from this box and insert a record into a new table with data I populate in the 2 text files (Im using the combo so users cant type in values wrong and have duplicate data) My code seems simple but I keep getting a Runtime Error 3134 Syntax Error in INSERT INTO statement. Here is the code
Private Sub cmdUpdate_Click()
On Error GoTo Err_cmdUpdate_Click
DoCmd.RunSQL "insert into tbl_Updates (Date,Memo,ProjectName) " & _
"select distinct " & _
"[Forms]![frmUpdate]![txtMemo] as Memo, " & _
"[Forms]![frmUpdate]![txtDate] as Date, " & _
"[Forms]![frmUpdate]![cboProjectName] as ProjectName from tbl_Updates;"
DoCmd.GoToRecord , , acNewRec
Exit_cmdUpdate_Click:
Exit Sub
Err_cmdUpdate_Click:
MsgBox Err.Description
Resume Exit_cmdUpdate_Click
End Sub
Private Sub cmdUpdate_Click()
On Error GoTo Err_cmdUpdate_Click
DoCmd.RunSQL "insert into tbl_Updates (Date,Memo,ProjectName) " & _
"select distinct " & _
"[Forms]![frmUpdate]![txtMemo] as Memo, " & _
"[Forms]![frmUpdate]![txtDate] as Date, " & _
"[Forms]![frmUpdate]![cboProjectName] as ProjectName from tbl_Updates;"
DoCmd.GoToRecord , , acNewRec
Exit_cmdUpdate_Click:
Exit Sub
Err_cmdUpdate_Click:
MsgBox Err.Description
Resume Exit_cmdUpdate_Click
End Sub