Hi list,
Thanks for the quick answer this morning.
I'm trying to execute a SQL statement from within
Visual Basic for MS Access. I have RTFM, the online
help is either incredibly dumbed down or arcane and
indecipherable.
I'm trying to assemble the statement by concatenating
strings and passing the lot to DoCmd.RunSQL
I'm getting a syntax error but I can't find it.
Here is my code:
Private Sub SendUpdate_Click()
' Code to put the contents of the fields into the
database
' Embedded SQL statement
' Simeon Veldstra, BIM-Ltd 2000
Dim ConnectString As String
Dim SQLStatement As String
ConnectString = Chr$(34) & "ODBC;" & Chr$(34) & "
[DSN=testdb;]"
SQLStatement = "INSERT INTO sim IN " &
ConnectString
SQLStatement = SQLStatement & " (motorcycle,
displacement, make, model, color, year) "
SQLStatement = SQLStatement & " VALUES ( " &
Me!motorcycleIn & ", " & Me!displacementIn & ", "
SQLStatement = SQLStatement & Me!makeIn & ", " &
Me!modelIn & ", " & Me!colorIn & ", " & Me!yearIn & ")
"
'Put string into window so I can check it
Me!SQLWindow = SQLStatement
DoCmd.RunSQL (SQLStatement)
End Sub
All the &'s evaluate to:
INSERT INTO sim IN "ODBC;" [DSN=testdb;]
(motorcycle, displacement, make, model, color, year)
VALUES ( Little Red, 70, Honda, C70, red, 1982)
(newlines added for clarity)
The examples in the online help all interface to other
microsoft products
I am running 7.0.2 on linux
Thanks in advance for any help
Simeon Veldstra
--Failure is not an option, it comes bundled with your
Microsoft product
_______________________________________________________
Do You Yahoo!?
Get your free @yahoo.ca address at http://mail.yahoo.ca