Jon,
thanks for getting back to me. I thought that was the case so I have worked out something else. I place a row into a new list box, which is red, if the item meets the criteria. I have that working fine but am now looking at how I can delete an item from that list box if the user deletes the item from the main list box. We use the Add, Delete, Clear buttons/code you're probably familiar with since we had Elite develop our first New Client Matter form.
I added some code to the delete button to determine if the client record to be deleted meets the criteria and if so, then to go to the other list box, locate the row and delete it. I am wondering if I need to somehow change the focus to that list box. Focus is on the main list box because the user selects the record in the main list box and then clicks the Delete button. I have tried alot of different things to delete the row in my 2nd list (you will see all of the commented out items). I have noted the beginning and end of the 'problem code' with comments. I have included all of the code for this section. lstExp is main list box, lstOutARUnbilled is the other list box.
If (lstExp.CurrentSelection <> 0) then
strlist = Trim(Expholder.text) & Trim(ExpDate.Text) & ";" & Trim(Purpose.Text) & ";" & Trim(Category.Text) & ";" & Trim(clnum.text) & ";" & trim(clname2.text) & ";" & trim(GenLedger.Text) & ";" & trim(CostCodeName.Text) & ";" & trim(CostCodeCode.Text) & ";" & trim(ExpDesc.Text) & ";" & trim(Amount.text)
clientnum = ""
if Amount.Text > 1000 and Purpose.Text = "Client Charge" then
szSQL = "Select sum(arage4+arage5) from dw_dailyar where (mmatter = '" & trim(clnum.text) & "'" & " and fco = 'F') or (mmatter = '" & trim(clnum.text) & "'" & " and fco = 'C')"
fresult1 = WFDataClient.ConvertResultSetToSingleString(WFDataClient.ExecuteScalarWithConnName(szSQL,Global.gConnWFDC))
szSQL = "Select sum(wipfees4+wipcosts4) from dw_dailyubtc where (mmatter = '" & trim(clnum.text) & "'" & ")"
fresult2 = WFDataClient.ConvertResultSetToSingleString(WFDataClient.ExecuteScalarWithConnName(szSQL,Global.gConnWFDC))
fresult = fresult1 + fresult2
if fresult <> "" then
if fresult > 0 then
'have determined in lstOutARUnbilled list
'now determine if another record in lstexp with same cm# which is >1000
'if so, leave in list, if not delete from lstOutARUnbilled
For irow = 1 to lstExp.ListCount
clientnum = lstExp.RetrieveItem(irow,4)
if clientnum = trim(clnum.text) then
if lstExp.RetrieveItem(irow,10) > 1000 then
DeleteOutARYes = "Y"
else
DeleteOutARNo = "N"
end if
end if
Next
if DeleteOutARNo <> "N" then
'forms.controls.item(lstOutARUnbilled).ActiveControl.Name
'start of problem code
For irow2 = 1 to lstOutARUnbilled.ListCount
if clientnum = lstOutARUnbilled.RetrieveItem(irow2,1) then
iindex= lstOutARUnbilled.CurrentSelection
'iindex = lstOutARUnbilled.RetrieveItem(CurrentSelection)
lstOutARUnbilled.Removeitem (iindex)
'iindex = lstOutARUnbilled.CurrentSelection
'iindex = lstOutARUnbilled.RetrieveItem(irow,1)
'lstOutARUnbilled.Retrieveitem(iindex)
'lstOutARUnbilled.RemoveItem
'lstOutARUnbilled.Selected(iindex)
'lstOutARUnbilled.RemoveItem(iindex)
end if
next
'end of problem code
end if
end if
if lstOutARUnbilled.ListCount = 0 then
lstOutARUnbilled.Visible = False
txtoutstandingAR.Visible = False
end if
end if
end if
end if
Thanks!!!