SQL in VBA

  • Thread starter Thread starter Nelson
  • Start date Start date
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)"
 
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.
 
Back
Top