Access Run-time Error 3134

I have the following code that I have read and made changes to for the last 3 hours and just can seam to get it working.

The error I get is "Syntax error in INSERT INTO statement"

Private Sub AddRecord_Click()

'Add the form details to the table

CurrentDb.Execute "INSERT INTO (Transactions (tDate,  category, transAmount, transDescription) " & _
    "VALUES & (" & _
    "'" & Me.txt_tDate & "', " & _
    "'" & Me.cmb_Category & "', " & _
    "'" & txt_TransAmount & "', " & _
    "'" & Me.txt_transDescription & "' " & _
    ")"


End Sub

The form has 4 fields as above with the tDate being set to Date() by default and all others as short text or number.

Any advice welcome.

Thanks

Answers


Remove the first & in this line:

"VALUES & (" & _

So it is:

"VALUES (" & _

Further, hardly all values are text, thus:

"#" & Format(Me.txt_tDate, "yyyy\/mm\/dd") & "#, " & _
"'" & Me.cmb_Category & "', " & _
"" & Str(txt_TransAmount) & ", " & _
"'" & Me.txt_transDescription & "' " & _

where Str will convert a decimal value to a string with dot as the decimal separator.


Need Your Help

Are there built-in "simplifications" with Roslyn?

c# roslyn

Is there any built-in way to use Roslyn to perform the same compile-time transformations that the C# compiler does, e.g. for transforming iterators, initializers, lambdas, LINQ, etc. into basic C# ...