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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox, move all value help

Status
Not open for further replies.

lashwarj

IS-IT--Management
Nov 1, 2000
1,067
US
I can not seem to get the below code to work, it sort of works, but all it does is hit the first record and make the list box populate with it until you hit esc and terminate it


DO WHILE THIS.PARENT.approval_list.ListCount > 0
SET DECIMALS TO 0
approval_ID_number = VAL(Thisform.approval_list.List(1))

SELECT Approval_info
LOCATE FOR approval_ID_number = approval_info.approval_id
Vapprovalnum = ALLTRIM(approval_info.approval_num)
Vapproval_id = STR(approval_id_number)
WITH ThisForm.agenda_List
.ADDITEM(Vapproval_id)
.ADDLISTITEM(Vapprovalnum , .ListCount, 2)
ENDWITH
ENDDO
 
Hello,

You would appear to be always selecting the first item in the approval_list and your DO WHILE condition will always be true.

After you have added the item to the agenda_list you need to move an index on or wrap the code with a FOR loop up to the number of approval_list.ListCount ?

Hope this helps.
 
DO WHILE THIS.PARENT.approval_list.ListCount > 0
SET DECIMALS TO 0
approval_ID_number = VAL(Thisform.approval_list.List(1))

SELECT Approval_info
LOCATE FOR approval_ID_number = approval_info.approval_id
Vapprovalnum = ALLTRIM(approval_info.approval_num)
Vapproval_id = STR(approval_id_number)
WITH ThisForm.agenda_List
.ADDITEM(Vapproval_id)
.ADDLISTITEM(Vapprovalnum , .ListCount, 2)
ENDWITH
ENDDO

Set decimal to 0
Sele ApprovalInfo
For nIndex = 1 to This.Parent.Approval_List.ListCount
approval_ID_number = VAL(Thisform.approval_list.List(nIndex))

LOCATE FOR approval_ID_number = approval_info.approval_id
if found()
Vapprovalnum = ALLTRIM(approval_info.approval_num)
Vapproval_id = STR(approval_id_number)
WITH ThisForm.agenda_List
.ADDITEM(Vapproval_id)
.ADDLISTITEM(Vapprovalnum , .ListCount, 2)
ENDWITH
else
messagebox("Approval ID was not found " + approval_Id_number)
endif
next

Ali Koumaiha
TeknoSoft Inc
Farmington Hills, Michigan
 
The above code should not contain the first paragraph which is (copy and paste of the original question)
But the bottom one is the suggested correction to your code!

Peace!

Ali Koumaiha
TeknoSoft Inc
Farmington Hills, Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top