An Array Problem

  • Thread starter Thread starter Gordon Padwick
  • Start date Start date
G

Gordon Padwick

How do I delete something from an array. Seems it should be easy, but I
haven't found anything in the Access documentation or various Access books
to help me on this one.

After creating a one-dimensional array, how can I scan through that array
and then delete items that satisfy certain criteria? For example, in an
array of strings, how would I delete all elements that contain a specific
string such as "" or "XXX". Assuming that's possible, does Access
automatically renumber the array elements and the UBOUND property?

Gordon
 
Gordon Padwick said:
How do I delete something from an array. Seems it should be easy, but I
haven't found anything in the Access documentation or various Access books
to help me on this one.

After creating a one-dimensional array, how can I scan through that array
and then delete items that satisfy certain criteria? For example, in an
array of strings, how would I delete all elements that contain a specific
string such as "" or "XXX". Assuming that's possible, does Access
automatically renumber the array elements and the UBOUND property?

Gordon

You don't "delete elements" of an array, unless it is an array class to
which you, or someone else has added a delete function. If you have much of
this to do, then it will be much simpler to use a table instead of an array.

Basically, to delete an entry from an array, you simply move all following
entries down one element, and clear the final one (or resent the pointer to
the last one). If you have several items to remove, you could make one pass
to mark them then work backwards to move the data down one each time you
find one marked for deletion. That could save some execution time.

Larry Linson
Microsoft Access MVP
 
Back
Top