Solved

Loop needed

Posted on 2003-11-07
5
268 Views
Last Modified: 2011-04-14
Could somebody please help me with a simple loop. I need the code below to take the value entered into "b" and increment it until it reaches b+12, then exit. I've tried different loops and they have all failed or got stuck in an enternal loop. Any assistance would be greatly appreciated. Thank you.

Sub a11()

    On Error GoTo ErrorHandler

    Const NEVER_TIME_OUT = 0

    Dim BS As String    ' Chr$(rcBS) = Chr$(8) = Control-H
    Dim ESC As String   ' Chr$(rcESC) = Chr$(27) = Control-[

    BS = Chr$(rcBS)
    ESC = Chr$(rcESC)

With Session

b = Application.InputBox("Enter the beginning VT1 SDF")

   
    .Transmit "ent-vt1::vt1-" & b & "-1&&-28:veo;"
Session.Wait 10

'Call a12
Exit Sub

ErrorHandler:
    .MsgBox Err.Description, vbExclamation + vbOKOnly

    End With
End Sub
0
Comment
Question by:vharrig
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 9702632
With Session
   b = Application.InputBox("Enter the beginning VT1 SDF")

   for i = b to b + 12    
     .Transmit "ent-vt1::vt1-" & b & "-1&&-28:veo;"
     Session.Wait 10
   next
0
 

Author Comment

by:vharrig
ID: 9702703
bobbit31

Thank you, but the same value keeps coming up. I'm entering 673 into the inputbox and I need it to increment 674, 675 - 684. The same problem happened to me when I was trying as well. Any more suggestions?
0
 
LVL 2

Accepted Solution

by:
MaxPol earned 50 total points
ID: 9702815
bobbit31 was almost right,

With Session
   b = Application.InputBox("Enter the beginning VT1 SDF")

   for i = b to b + 12    
     .Transmit "ent-vt1::vt1-" & i  & "-1&&-28:veo;"  'Verify that instead of  b, here you should place i
     Session.Wait 10
   next

So instead of b you should use i

0
 
LVL 18

Expert Comment

by:bobbit31
ID: 9702870
oops, typo ;) sorry for the confusion
0
 

Author Comment

by:vharrig
ID: 9702893
Thank you very much. That worked perfectly.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question