|
-
Oct 9th, 2000, 04:11 AM
#1
Hi there, I'm trying to make a sub function accessible only if multiple conditions are met. If I only use multiple AND's or multiple OR's at once it works fine but when I try to combine them it won't work. I wonder if I'm using the correct syntax. This is what I tried:
If (selected="Monday") And (id="A1" OR id="A2") then
{do certain things}
End If
Looks like I can't use the brackets but how else can it be done? Please send your suggestions.
Thank you for your time.
-
Oct 9th, 2000, 04:17 AM
#2
Junior Member
Try something like this...
Private Sub Command1_Click()
Dim a
Dim b
Dim c
a = "YES"
b = "NO"
c = "NO"
If a = "YES" And b = "YES" Or c = "YES" Then
MsgBox "Yup for A and maybe B or C"
End If
End Sub
'I test this and it seemd to work okay
-
Oct 9th, 2000, 04:41 AM
#3
Frenzied Member
Hardballa
(I'm assuming you are using the VBScript in an Active Server Page)
Your code looks ok to me!
I just tried this and it was OK.
Are you sure your values for selected, A1 and A2 are being set correctly?
Code:
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
dim selected
dim id
selected="Monday"
'selected="Tuesday"
'id="A2"
id="A1"
If (selected="Monday") And (id="A1" OR id="A2") then
response.write("conditions met")
else
response.write("conditions NOT met")
End If
%>
</form>
</BODY>
</HTML>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|