Running SQL statements in VB

  • Thread starter Thread starter AL
  • Start date Start date
A

AL

Why does this SQL run command always produces a syntax error. The string was
copied from a select query in Access that worked on the desktop.

Dim SQL As String
SQL = "SELECT StudentTable.SeqNO FROM StudentTable WHERE
((StudentTable.SeqNO)=2)"
DoCmd.RunSQL SQL
 
Your sql string is not an update, insert or delete query; so it doesn't make
sense to use it with DoCmd.RunSQL.
 
Back
Top