Proper Syntax

  • Thread starter Thread starter kealaz
  • Start date Start date
K

kealaz

Hello,
In a bit of code that I got from this site, there is this line.

For I = 1 To 6

Which tells the scrip to use the values in column 1 thru six of my combo
box. I just want to use columns 2, 4, and 6. What is the proper syntax to
use to make this change. I have tried 2, 4, 6 but does not work. Actually
I've tried several things. 2 or 4 or 6 does not work either, as I would like
3 values at my result, not just 1.

Thank you for all your help with this.
 
Try a select statement:

For I = 1 To 6
Select Case I
Case 2
'do something
Case 4
'do something
Case 6
'do something
Case Else
'don't do anything here
End Select
 
kealaz said:
Hello,
In a bit of code that I got from this site, there is this line.

For I = 1 To 6

Which tells the scrip to use the values in column 1 thru six of my combo
box. I just want to use columns 2, 4, and 6. What is the proper syntax
to
use to make this change. I have tried 2, 4, 6 but does not work.
Actually
I've tried several things. 2 or 4 or 6 does not work either, as I would
like
3 values at my result, not just 1.

Thank you for all your help with this.


If you look in the Visual Basic Language section of the help file for "For
.... Next Statement", you'll find complete documentation of this statement.
Reading that, you'll see that you could write:

For I = 2 to 6 Step 2

to accomplish what you want.
 
kealaz said:
Hello,
In a bit of code that I got from this site, there is this line.

For I = 1 To 6

Which tells the scrip to use the values in column 1 thru six of my combo
box. I just want to use columns 2, 4, and 6. What is the proper syntax
to
use to make this change. I have tried 2, 4, 6 but does not work.
Actually
I've tried several things. 2 or 4 or 6 does not work either, as I would
like
3 values at my result, not just 1.

Thank you for all your help with this.

Try
For I = 2 To 6 Step 2
 
Thank you VERY much Dirk. This worked great!

Dirk Goldgar said:
If you look in the Visual Basic Language section of the help file for "For
... Next Statement", you'll find complete documentation of this statement.
Reading that, you'll see that you could write:

For I = 2 to 6 Step 2

to accomplish what you want.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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

Similar Threads


Back
Top