SQL in loop

  • Thread starter Thread starter Jean-Paul De WInter
  • Start date Start date
J

Jean-Paul De WInter

Hi,

In following code:

Dim i As Integer
For i = 1 To 5
if Me("field" & CStr(i)) = 5 then
SQL_vak = "SELECT lessenrooster_lln.vak FROM lessenrooster_lln WHERE
lessenrooster_lln.uur='12' AND lessenrooster_lln.klas='" &
Forms!lessenrooster_lln!klas & "' ;"
end if
Next i

I would like to change the '12' in the SQL line into something like i+11 so
finally the output would be the same.
What is the correct syntax??
(the lessenrooster_lln.uur is a text field and not a number field)

Thanks
JP
 
"...lln.uur='" & cstr(i + 11) & "' AND..."

Note the single + double quote (urr='" &) and double + single quote (& "'
AND) leading into and out of the string variable.

HTH,

George Nicholson

Remove 'Junk' from return address.
 
thanks... going to test tomorrow
JP

George Nicholson said:
"...lln.uur='" & cstr(i + 11) & "' AND..."

Note the single + double quote (urr='" &) and double + single quote (& "'
AND) leading into and out of the string variable.

HTH,

George Nicholson

Remove 'Junk' from return address.
 
Back
Top