At the end of your sql statement (.." & r_id & ""), remove the & "" so that it looks like this: & " WHERE W.ID = " & r_id