Expected End Statement

J

Joe

Hello,

My vb code is giving me an error after I enter and underscore to seperate my
lines...

Any ideas why? I receive the Error: Expected End Statement...

Function

Dim strSQL As String

strSQL = "Select [mast].acct_nbr, [mast].bank, _
INTO portfolio FROM mast WHERE balance > 0"

DoCmd.RunSQL strSQL

Thanks
 
D

Dirk Goldgar

Joe said:
Hello,

My vb code is giving me an error after I enter and underscore to seperate
my
lines...

Any ideas why? I receive the Error: Expected End Statement...

Function

Dim strSQL As String

strSQL = "Select [mast].acct_nbr, [mast].bank, _
INTO portfolio FROM mast WHERE balance > 0"

DoCmd.RunSQL strSQL


You can't break your line in the middle of a string literal. Try this
instead:

strSQL = "Select [mast].acct_nbr, [mast].bank " & _
"INTO portfolio FROM mast WHERE balance > 0"

I also took out the extra comma you had after "[mast].bank", which would
have made the SQL statement fail when executed.
 
J

Joe

Thanks Dirck... That worked just fine

Dirk Goldgar said:
Joe said:
Hello,

My vb code is giving me an error after I enter and underscore to seperate
my
lines...

Any ideas why? I receive the Error: Expected End Statement...

Function

Dim strSQL As String

strSQL = "Select [mast].acct_nbr, [mast].bank, _
INTO portfolio FROM mast WHERE balance > 0"

DoCmd.RunSQL strSQL


You can't break your line in the middle of a string literal. Try this
instead:

strSQL = "Select [mast].acct_nbr, [mast].bank " & _
"INTO portfolio FROM mast WHERE balance > 0"

I also took out the extra comma you had after "[mast].bank", which would
have made the SQL statement fail when executed.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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