×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Problem with singe digit numbers in a Do Loop

## Problem with singe digit numbers in a Do Loop

(OP)
I'm having a problems with the value of  LPANum and HPANum in this Do Loop  statement.

Dim szLPANum$, szHPANum$

If I use the following singe digit numbers:

LPANum 3
HPNum  6

It display 3 ( Msgbox j) and End the if and the Do Loop

If I use the following two digits numbers:

LPANum 10
HPNum  12

The Do Loop works great.

j = szLPANum

Do

If j > szHPANum Then
Msgbox j
Exit DO

Else
j = j +1

Msgbox j

End if

Loop
Msgbox j

### RE: Problem with singe digit numbers in a Do Loop

Problems?

Do we have to guess?

Would you like help?

Maybe a little bit more specific information?

Skip,

Just traded in my old subtlety...
for a NUANCE!

### RE: Problem with singe digit numbers in a Do Loop

(OP)
Thanks Skip

This is the test Macro I'm using:

Declare Function DisplayChoice(ioutput%, szWCNum$, szHouseNum$, szStrNam$, szBuildNam$, szCABNum$, _ szLPANum$, szHPANum$, szserterm$) As String

Sub Main
Dim szWCNum$, szHouseNum$, szStrNam$, szBuildNam$, szCABNum$, szLPANum$, szHPANum$, szserterm$
Dim ioutput%
Dim iDone%
Dim szAPPL as String

Begin Dialog dlgIMSENT 200, 100, 300, 250, "Information for CLEC"
ButtonGroup .ButtonPressed
OkButton     100,  200, 50, 14, .cmdOK
CancelButton 180,  200, 50, 14, .cmdCancel
OptionGroup .ogoutput
OptionButton  10,  80,  63,  10, "RMV FA(2 wire)", .btnREMFA2
OptionButton  10, 100,  63,  10, "RMV FA(4 wire)", .btnREMFA4
OptionButton  10, 120,  63,  10, "CHANGE FA", .btnCHANGE

Text     120,  20,   61,  20, "Wire Center:             (2 Characters)"
Textbox  200,  20,  80,  10, .tbxWCNum

Text     120,  40,   61,  20, "House Number:          (up to 13 Characters)"
Textbox  200,  40,  80,  10, .tbxHouseNum

Text     120,  60,   61,  20, "Street:                        (up to 50 Characters)"
Textbox  200,  60,  80,  10, .tbxStrNam

Text     120, 80,   61,  20, "Buliding:                     (5 Characters)"
Textbox  200, 80,  80,  10, .tbxBuildNam

Text     120,  100,   61,  20, "Cable Number:            (5 Characters)"
Textbox  200,  100,  80,  10, .tbxCABNum

Text     120,  120,   61,  20, "Low Pair:                     (2 Characters)"
Textbox  200,  120,  80,  10, .tbxLPANum

Text     120, 140,   61,  20, "High Pair:                   (2 Characters)"
Textbox  200, 140,  80,  10, .tbxHPANum

Text     120, 160,   61,  20, "Serving Term:       (up to 50 Characters)"
Textbox  200, 160,  80,  10, .tbxserterm

Text  10, 20, 100, 9, "Select Transaction:."

End Dialog

iDone = FALSE

While (iDone = FALSE)
Dim dMain as dlgIMSENT

nRet = Dialog(dMain)

Dim iResponse As Integer
Dim dlg As dlgIMSENT
iResponse = Dialog(dMain)

Select Case nRet
Case -1                       ' -1 is returned if the user chose OK
iDone = TRUE
ioutput = dMain.ogoutput

szWCNum = dMain.tbxWCNum
szHouseNum = dMain.tbxHouseNum
szStrNam = dMain.tbxStrNam
szBuildNam = dMain.tbxBuildNam
szCABNum = dMain.tbxCABNum
szLPANum = dMain.tbxLPANum
szHPANum = dMain.tbxHPANum
szserterm = dMain.tbxserterm

szAPPL = DisplayChoice(ioutput, szWCNum, szHouseNum, szStrNam, szBuildNam, szCABNum, _
szLPANum, szHPANum, szserterm)

'                msgbox (szAPPL)

Case 0                        ' 0 is returned if the user chose Cancel
iDone = TRUE

Case 1                        ' 1 is returned if the user chose Reset
dMain.ogoutput = 0

Case Else
msgbox "Some undefined button pressed " + str(dMain.ButtonPressed)

End Select

Wend

End Sub

Function DisplayChoice(ioutput%, szWCNum$, szHouseNum$,       szStrNam$, szBuildNam$, szCABNum$, _ szLPANum$, szHPANum$, szserterm$) As String

Dim szIMSENT\$
' -------------------------------------

Select Case ioutput

Case 0

j = szLPANum

Do

If j > szHPANum Then
Msgbox j
Exit DO

Else
j = j +1

Msgbox j

End if

Loop
Msgbox j

Case 1

Msgbox szLPANum
Msgbox szHPANum

j = szLPANum

Do

If j > szHPANum Then
Msgbox j
Exit DO

Else
k = j

Msgbox j

j = j +1

Msgbox j

j = j +1

Msgbox j

End if

Loop
Msgbox j

Case 2

Msgbox "REMOVE FALP 2 wire"

Case 3

Msgbox "REMOVE FALP 4 wire"

Case 4

Msgbox "CHANGE FALP "

End Select

' ------------------------------------

End Function

### RE: Problem with singe digit numbers in a Do Loop

You have explained NOTHING AT ALL!!!

Do you really have a problem that you want some advice about?

Skip,

Just traded in my old subtlety...
for a NUANCE!

### RE: Problem with singe digit numbers in a Do Loop

das99das,

i ran your script using 3 & 6. it exited at 7, which is what it should do. i don't see any problems.

i would test the entry to verify it's a number though.

rem

### RE: Problem with singe digit numbers in a Do Loop

(OP)
How do you put a value in sess0.screen.sendkeys from a textbox?

textbox tbxEnt value is #
szEnt = dMain.tbxEnt

If I do a  msgbox szEnt -  I get #

Sess0.Screen.Sendkeys("szEnt")    - I also try just szEnt
Sess0.Screen.Sendkeys("<Enter>")

When I test this, I get szEnt on the Screen

How do I set up szEnt so the value is set to # on the  Sess0.Screen.Sendkeys ?

### RE: Problem with singe digit numbers in a Do Loop

#### CODE

Sess0.Screen.Sendkeys(szEnt)

Skip,

Just traded in my old subtlety...
for a NUANCE!

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!