SQL in VBA

N

Nelson

what's wrong with the following string??

sqlstring = "SELECT staff.staffid , NewJoinMPF.payid" & _
"FROM staff LEFT JOIN (paydetail LEFT JOIN NewJoinMPF ON
paydetail.payid = NewJoinMPF.payid) ON staff.staffid = paydetail.staffid" &
_
"WHERE staff.staffid='" & Me.staffid & "' AND (Not
NewJoinMPF.payid Is Null)"
 
D

Dan Artuso

Hi,
You need a space before the word From and and also before Where.
Always do a Debug.Print sqlstring so that you can easily see where you've
gone wrong. Also, if staffid is numeric, you don't need the delimters.
 

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