Syntax for setting 2 variables following if statement

  • Thread starter Thread starter Paul Cooper
  • Start date Start date
P

Paul Cooper

Hello,

Can anyone tell me the correct syntax for setting 2
variables following an if statement.

I've tried this but it doesn't work:

If Screen.ActiveControl.name = "Combo63" Then var1 = 1 AND
var2 = "Home"

It sets neither variable!

Help please! Thanks

PAul
 
Paul said:
Hello,
Can anyone tell me the correct syntax for setting 2
variables following an if statement.
I've tried this but it doesn't work:

If Screen.ActiveControl.name = "Combo63" Then var1 = 1 AND
var2 = "Home"

There are two syntactical versions for If-Then. If it's all on one line
then you don't need an End If and you would typically only have one
statement that you would execute in the "Then" part. The second form
uses multiple lines and the End If to create a block. With that format
you can execute as many statements as you want.

If Screen.ActiveControl.name = "Combo63" Then
var1 = 1
var2 = "Home"
End If
 
Back
Top