Syntax for setting 2 variables following if statement

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
 
R

Rick Brandt

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top