The following code checks to see if there are items in the lstExp list box. Then it starts at row 1, and if (irow,6) is not empty, it retrieves the data as NewGLNo. Then if the last 4 characters are <> "0000", it replaces the last part with a new TKNo value and saves as NewTLNo. I then want to replace that row,column with the new number (NewGLNo).
if lstExp.ListCount > 0 then
for irow = 1 to lstExp.ListCount
if lstExp.RetrieveItem(irow,6) <> "" then
NewGLNo = lstExp.RetrieveItem(irow,6)
msgbox NewGLNo
if right(NewGLNo,4) <> "0000" then
NewGLNo = mid(NewGLNo,1,15) & TKNo.Value
msgbox NewGLNo
lstExp.ReplaceItem(NewGLNo,irow,6)
end if
end if
next
end if
When this code runs I get the error, "cannot use parentheses when calling a sub." If I comment out the ReplaceItem line, there is no error but, of course, the replace doesn't occur. What is the proper format for ReplaceItem? I have tried saving the data to a field on the form as well as to a variable.
Thanks in advance.! Mary