SQL statement with two ";"

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.
 
K

Ken Snell [MVP]

Using your generic code:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top