RE: Insert Statement Syntax



Nevermind, I found the correct syntax. Here it is incase other people have
the same problem

Public Sub AddValues()
Dim strString As String
strString = "INSERT INTO import(Agency, Regular, AWG, Rehab, FFEL, FDSLP,
Direct) SELECT "
strString = strString & Agency & " as Agency, " & Regular & " as Regular,"
& AWG & " as AWG," & Rehab
strString = strString & " as Rehab," & FFEL & " as FFEL," & FDSLP & " as
FDSLP," & Direct & " as Direct"
DoCmd.RunSQL strString
End Sub



"Klatuu" wrote:

doesn't work in Access doesn't give us much to go on. Please describe the
problem.
--
Dave Hargis, Microsoft Access MVP


"Magius96" wrote:

Coming from MySQL to Access, I realize there are some syntax differences.
The following code works in MySQL, but doesn't work in Access. What's the
correct syntax for the SQL string?

Public Sub AddValues()
Dim strString As String
strString = "Insert into [import] set [Agency]='" & Agency & "',
[Regular]=" & Regular & ", [AWG]=" & AWG
strString = strString & ", [Rehab]=" & Rehab & ", [FFEL]=" & FFEL & ",
[FDSLP]=" & FDSLP & ", [Direct]=" & Direct
DoCmd.RunSQL strString
End Sub

.



Relevant Pages