| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi
I have a table in an Access DB, containing members and lessons and weeks. Each members has at least one lesson per week. Column namnes are recID, recName, recLesson, and the weeks (like w46, w47, w48 etc). Now I would like the count the number of cancellations the members does for the weeks. So I use this code, and it works just fine: RS.Source = "SELECT Count(*) AS intTotal FROM tbl_lesson WHERE recLesson LIKE 'we 18.00' AND w48 LIKE 'C'" So now to my problem, Iwould like to use a variable instead of the "w48". I have a CASE where I set the variable week depending on current week. So I want my code look like this instead: RS.Source = "SELECT Count(*) AS intTotal FROM tbl_lesson WHERE recLesson LIKE 'we 18.00' AND week LIKE 'C'" But, I cant get it to work :-( (week works fine I use it when I display the lessons, it automatically pick the current week) Any idea or suggestions on how to solve it? Thanks in advance /B |
|
#2
|
|||
|
|||
|
:-D... It is just great to write the problem down here..I just solved it like this
RS.Source = "SELECT Count(*) AS intTotal FROM tbl_lesson WHERE recLesson LIKE 'we 18.00' AND " & week & " LIKE 'C'" Thanks anyhow, and I hope that someone else has use of it. /B |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Using a variable in WHERE statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|