MikeH
|
| Posted: 06/30/2002, 6:13 AM |
|
I like to limit the number of users till 10.
I added:
rs=cn.execute("SELECT members.member_login FROM members;")
If rs(Count("members.member_login")) > 10 then
sFormNameErr="The number of users is limited to 10"
End if
in the Open Event (using CC, ASP and Access)
Can anyone tell me what I am doing wrong?????
Thanks in advance
|
|
|
 |
Chris K.
|
| Posted: 06/30/2002, 7:48 AM |
|
USe dlookup function instead, it much compact syntax. To count users you have to use Count() function within SQL SELECT expression not in ASP.
if dlookup("members","count(member_login)","true") > 10 then
....
end if
(you could give some filtering WHERE expression as third parameter)
|
|
|
 |
MikeH
|
| Posted: 06/30/2002, 9:59 AM |
|
Thanks for the quick response. I don't understand where I have to put the code: in Form Properties - SQL or Form Properties - Events??
|
|
|
 |
Chris K.
|
| Posted: 06/30/2002, 10:56 AM |
|
The question is what do you want to limit? Maximum number of user registered? If 11th user tries to register he is rejected? If so this code could go to Before Insert event to cancel new user registration.
|
|
|
 |
MikeH
|
| Posted: 06/30/2002, 11:54 AM |
|
Sorry, still not working. Exact code:
if dlookup("members","count(member_id)","true") > 10 then
sFormNameErr="The number of users is limited to 10"
End if
table and field (members, member_id) are correct and still not working. Do I have to add parameters in input?
Your conclusion was correct: to prevent the input of the 11th user
|
|
|
 |
Chris K.
|
| Posted: 06/30/2002, 12:56 PM |
|
The problem could be sFormNameErr variable. Are you sure your form is called FormName? Because form's error variable that is used to prevent SQL operations must be called like s<nameoftheform>Err, replacing <nameoftheform> with your form name.
Check your execution path by putting sample response.writes in generated code (numbers for instance). Check if condition hits or if s<form>Err checking fails.
|
|
|
 |