MS Access Embedded SQL

From: Simeon Veldstra <s_veldstra(at)yahoo(dot)ca>
To: pgsql-novice(at)hub(dot)org
Subject: MS Access Embedded SQL
Date: 2000-07-31 21:48:30
Message-ID: 20000731214830.29648.qmail@web4501.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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

Browse pgsql-novice by date

  From Date Subject
Next Message David Lloyd-Jones 2000-08-01 00:03:52 Presenting PGAccess Pages to the WWW.
Previous Message Lamar Owen 2000-07-31 18:54:44 Re: PSQL Working, but PGAccess Not Connecting.