Insert into? (1 Viewer)

irade92

Registered User.
Local time
Today, 18:35
Joined
Dec 26, 2010
Messages
229
Hi
why this doesn't work
mATC_FULL = "escitaloptam tabl. 20 mk"
DoCmd.RunSQL "INSERT INTO tblXML_LEKOVI_KOM (GENERIKA_FULL) VALUES (" & mATC_FULL & ")"

field GENERIKA_FULL is text
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:35
Joined
May 7, 2009
Messages
19,229
...VALUES ('" & mATC_FULL & "')"
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:35
Joined
May 21, 2018
Messages
8,525
May want to look at my discussion for why and the CSql function.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 17:35
Joined
Jul 9, 2003
Messages
16,272
why this doesn't work

It's very difficult to get the syntax right in these notorious INSERT INTO SQL Statements
A solution I promote is to divide and conquer, break your SQL Statement down into smaller elements and then reassemble it. I've noticed that a lot of coding relies on repeating patterns, and if you adopt/learn a pattern, save a sample of the pattern as I described on my website (very easy to do) then use the pattern again and again. This way you can reduce syntax errors a 100-fold. For more information about my solution and videos and samples that you can download, see my website here:- https://www.niftyaccess.com/insert-into-sql-statement/
 

Users who are viewing this thread

Top Bottom