This content has been marked as final. Show 4 replies
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"
DeleteOutARNo = "N"
if DeleteOutARNo <> "N" then
'start of problem code
For irow2 = 1 to lstOutARUnbilled.ListCount
if clientnum = lstOutARUnbilled.RetrieveItem(irow2,1) then
'iindex = lstOutARUnbilled.RetrieveItem(CurrentSelection)
'iindex = lstOutARUnbilled.CurrentSelection
'iindex = lstOutARUnbilled.RetrieveItem(irow,1)
'end of problem code
if lstOutARUnbilled.ListCount = 0 then
lstOutARUnbilled.Visible = False
txtoutstandingAR.Visible = False
I would appreciate any help you can give me with this. I have asimilar problem to your origional query.
I have a list of names in Excel.
I then have a User Form that calls the list from Excel into a List Box in the User Form.
I want to highlight some of the names in the list, so that Users can know which ones to select from the list when they open the User form.
I have several forms in which I populate list boxes, but I load from SQL tables. I use a selection criteria to determine which rows from the SQL table should be in the list box. That eliminates the need to highlight specific rows. The list box contains a subset from the SQL table and any row in the list box may be selected.