Using Memory viarable

S

Song Su

I have following:

Dim mYYYY as String, mSem as String
mYYYY="2007"
mSem="3"

How to fix following line to use mYYYY and mSem? I am confused with
single/double quote.

dbs.Execute "DELETE * FROM " & _
"Transcript WHERE yyyy = '2007' and sem = '3';"
 
D

Dirk Goldgar

Song Su said:
I have following:

Dim mYYYY as String, mSem as String
mYYYY="2007"
mSem="3"

How to fix following line to use mYYYY and mSem? I am confused with
single/double quote.

dbs.Execute "DELETE * FROM " & _
"Transcript WHERE yyyy = '2007' and sem = '3';"


Try:

dbs.Execute _
"DELETE * FROM Transcript " & _
"WHERE yyyy = '" & mYYYY & "' and sem = '" & mSem & "';"
 
J

John W. Vinson

I have following:

Dim mYYYY as String, mSem as String
mYYYY="2007"
mSem="3"

How to fix following line to use mYYYY and mSem? I am confused with
single/double quote.

dbs.Execute "DELETE * FROM " & _
"Transcript WHERE yyyy = '2007' and sem = '3';"

Concatenate the values of the fields into the string, along with the
singlequote delimiters:

dbs.Execute "DELETE * FROM Transcript WHERE yyyy = '" & mYYYY & "' AND sem =
'" & mSem & "';"


John W. Vinson [MVP]
 
M

Marshall Barton

Song said:
I have following:

Dim mYYYY as String, mSem as String
mYYYY="2007"
mSem="3"

How to fix following line to use mYYYY and mSem? I am confused with
single/double quote.

dbs.Execute "DELETE * FROM " & _
"Transcript WHERE yyyy = '2007' and sem = '3';"


dbs.Execute "DELETE * FROM Transcript " & _
"WHERE yyyy = '" & mYYYY & "' And sem = '" & mSem & "' "
 

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