Hi All,
I have received help before; hopefully someone will be able to help me out. I have a combo box [ComboActivity] on my main form [Main Acct Details], once the selection is made I would like for the account to append to another table. The source for the Main form is a query [Qry SP ALL]. I wrote the VB code below but I received this error ‘Run-time erro ‘3134’: Syntax error in INSERT INTO statement’
Could someone please look at it and tell me what I did wrong.
Code:
Private Sub ComboActivity_A fterUpdate()
DoCmd.SetWarnin gs False
mySQL = "INSERT INTO Tbl_AcctWcodes ([Acct#],PT_Name, Acct_Bal, Pt_Status, FC, SC, ComboActivity) Select [forms]![Main Acct Details]![ACCT#] as a, [forms]![Main Acct Details]![PATIENT NAME] as b, [forms]![Main Acct Details]![ACCT BAL] as c, [forms]![Main Acct Details]![S] as d, [forms]![Main Acct Details]![F_C] as e, [forms]![Main Acct Details]![S/C] as f, [forms]![Main Acct Details]![ComboActivity] as g, FROM [forms]![Main Acct Details];"
DoCmd.RunSQL mySQL
DoCmd.RepaintOb ject acForm, "Main Acct Details"
Forms![Main Acct Details]!ComboActivity = Null
End Sub
I have received help before; hopefully someone will be able to help me out. I have a combo box [ComboActivity] on my main form [Main Acct Details], once the selection is made I would like for the account to append to another table. The source for the Main form is a query [Qry SP ALL]. I wrote the VB code below but I received this error ‘Run-time erro ‘3134’: Syntax error in INSERT INTO statement’
Could someone please look at it and tell me what I did wrong.
Code:
Private Sub ComboActivity_A fterUpdate()
DoCmd.SetWarnin gs False
mySQL = "INSERT INTO Tbl_AcctWcodes ([Acct#],PT_Name, Acct_Bal, Pt_Status, FC, SC, ComboActivity) Select [forms]![Main Acct Details]![ACCT#] as a, [forms]![Main Acct Details]![PATIENT NAME] as b, [forms]![Main Acct Details]![ACCT BAL] as c, [forms]![Main Acct Details]![S] as d, [forms]![Main Acct Details]![F_C] as e, [forms]![Main Acct Details]![S/C] as f, [forms]![Main Acct Details]![ComboActivity] as g, FROM [forms]![Main Acct Details];"
DoCmd.RunSQL mySQL
DoCmd.RepaintOb ject acForm, "Main Acct Details"
Forms![Main Acct Details]!ComboActivity = Null
End Sub
Comment