Delete from Array

Results 1 to 2 of 2

Thread: Delete from Array

  1. #1
    Join Date
    Dec 1969

    Default Delete from Array

    Hi<BR><BR>I am deleting from a multi dimensional array, will the code below work?, if so when I run it I get a Type mismatch on this line if aArray(iTemp) = accomDescriptID then.<BR><BR>bFound = False<BR> iUBound = UBound(aryDB1)<BR><BR> for iTemp = 0 to iUBound<BR> if aArray(iTemp) = accomDescriptID then<BR> aArray(iTemp) = aryDB1(iUBound)<BR> bFound = True<BR> end if<BR> next<BR><BR> if (True = bFound) then redim preserve aryDB1(iUBound - 1)<BR><BR>Thanks<BR><BR>Gary

  2. #2
    Join Date
    Dec 1969

    Default No you aren't

    aArray(iTemp) is a one dimensional array. aArray(iTemp,iTemp) would be a two dimensional or multi-dimensional array.<BR><BR>Your code, as it stands, doesn&#039;t make a whole lot of sense. You set aArray(iTemp) = aryDB1(iubound) for no apparent reason because aArray doesn&#039;t appear to get used elsewhere. Plus, the redim preserve simply reduces the size of aryDB1 by the last element. That doesn&#039;t appear to have anything to do with which element you wanted to delete.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts