Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2011
    Posts
    5

    Unanswered: Selected query results stored in array

    First Access VBA project I've done. Usually work in Excel.

    I have a query that generates a list with a date, time, name, and manager. I am trying to set it up so you can select certain records from the query then hit a button/key that will store those particular records in an array or some way that I can then send over to excel.

    I also plan on providing a form that will allow a reason code to be selected and appended to all the selected records (but not saved with the db record in access). I would be fine handling that in excel once the records are transfered over.

    I can't seem to find any other post where someone is trying to do this and need help getting started. Is there a way to store those highlighted records for manipulation?

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Quote Originally Posted by fathashome View Post
    I have a query that generates a list with a date, time, name, and manager.
    Please supply some info about the table(s) in use and a copy of the SQL statement of the query.
    Quote Originally Posted by fathashome View Post
    I am trying to set it up so you can select certain records from the query
    I never heard of a method that would allow to retrieve the selected lines from a Query object in Datasheet view (that does not mean it's impossible, though). You'll probably need to display the data set resulting from the query in a (sub)Form in Datasheet mode or use a List object.
    Quote Originally Posted by fathashome View Post
    hit a button/key that will store those particular records in an array or some way that I can then send over to excel.
    You can't do that from a Query object. You'll need to use a Form to be able to use a Command Button object.
    Quote Originally Posted by fathashome View Post
    I also plan on providing a form that will allow a reason code to be selected and appended to all the selected records (but not saved with the db record in access). I would be fine handling that in excel once the records are transfered over.
    What's a "reason code"? If you do not want to store any additional data into a table you'll need to use a VBA Array or possibly a VBA Collection (or a VBScript Dictionary). I don't understand the last sentence about Excel.
    Have a nice day!

Tags for this Thread

Posting Permissions

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