Share via

Create an Access Table from an ArrayList in VBA

Anonymous
2017-08-18T17:42:37+00:00

I have an ArrayList for which I need to use the records in an Access Query.  Is there a way to create an Access Table from the ArrayList, or pass the data directly into the criteria of my data?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

6 answers

Sort by: Most helpful
  1. Anonymous
    2017-08-21T13:03:04+00:00

    ArrayList is not part of VBA, so I assume you made a reference to the .NET System.Collections namespace, or you're using GetObject?

    If so, and if all you're doing is storing data then you'd be MUCH better off using a standard VBA Array. While you can work with some of the .NET stuff in VBA, it's well known to cause issues (out of memory, for one), since all too often those .NET objects work with values that VBA and Access simply don't understand, and will try to convert.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2017-08-20T19:23:04+00:00

    Thank you Daniel, let me see what I can do.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2017-08-20T19:22:21+00:00

    Thanks Tom, but I did create my ArrayList in VBA.

    Was this answer helpful?

    0 comments No comments
  4. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2017-08-19T16:47:05+00:00

    "ArrayList" seems to indicate you are in a .NET application. You want to populate your ArrayList with the results of an Access query. There are MANY ways to use databases in .NET applications. It's out of scope of this forum to get into that. You best ask in a forum about .NET database programming.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2017-08-18T20:37:12+00:00

    You could iterate through the array an execute a series of insert queries to populate your table.

    Was this answer helpful?

    0 comments No comments