Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with singe digit numbers in a Do Loop

Status
Not open for further replies.

das99das

Programmer
Mar 28, 2012
5
US
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


 


Problems?

Do we have to guess?

Would you like help?

Maybe a little bit more specific information?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
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, 40, 63, 10, "ADD FALP(2 wire)", .btnADDFA2
OptionButton 10, 60, 63, 10, "ADD FALP(4 wire)", .btnADDFA4
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

Msgbox "Add FALP 2 wire"


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 "Add FALP 4 wire"

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


 


You have explained NOTHING AT ALL!!!

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

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
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

 
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 ?




 


Code:
Sess0.Screen.Sendkeys(szEnt)

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top