SQL statement with two ";"

  • Thread starter Thread starter H. Martins
  • Start date Start date
H

H. Martins

Some time ago I got fromDStegon (via AccessMonster.com) the following:

"set a variable as a string and set it equal to the text of the qry
that you
are using. Then append the WHERE clause to the string and use that in
your
transfer line.

QryName As String
qryString As String

QryName ="qryExportTurmaToExcel"
qryString = CurrentDb.QueryDefs(QryName).sql

qryString = qryString & "WHERE blah blah blah" "

It should work OK except that I get two ";" in the SQL statement. How
do I get rid of the first? (I suppose there is no need to usr string
manipulation)

Thanks
Henry.
 
Using your generic code:

QryName ="qryExportTurmaToExcel"
qryString = CurrentDb.QueryDefs(QryName).sql
qryString = Replace(qryString, ";", "")
qryString = qryString & "WHERE blah blah blah" "
 
Back
Top