Hi, everyone I have a problem in SQL string
I have code like this:
Dim cnn As ADODB.Connection
Dim rs As New ADODB.Recordset
Set cnn = CurrentProject.Connection
SQL = "select * from tableA where Ponum='A5'"
rst.Open SQL, cnn, adOpenStatic, adLockReadOnly
.......
It works well, but if i want to use a Query name (Query6-it has same content as tableA) replace Table name tableA in SQL String:
SQL = "select * from Query6 where Ponum='A5'"
I got run time error, saying "syntax error in from clause"
is Queryname not allowed to use in SQL String?
Thanks for all clues!
rgao
I have code like this:
Dim cnn As ADODB.Connection
Dim rs As New ADODB.Recordset
Set cnn = CurrentProject.Connection
SQL = "select * from tableA where Ponum='A5'"
rst.Open SQL, cnn, adOpenStatic, adLockReadOnly
.......
It works well, but if i want to use a Query name (Query6-it has same content as tableA) replace Table name tableA in SQL String:
SQL = "select * from Query6 where Ponum='A5'"
I got run time error, saying "syntax error in from clause"
is Queryname not allowed to use in SQL String?
Thanks for all clues!
rgao