Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2006
    Posts
    4

    Using SELECT query within a VBA code in Access

    Please I need help in running a SELECT query within access VBA. I tried everything I know, but it does not seem to be working. I do not want to use a previously stored query, but instead would like to use the SQL within the code itself. I have seen some examples where you can use a previously saved query, but that will not work for my intended purpose. Thanks.

    Championss

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    What do you need to do with the results?

  3. #3
    Join Date
    Oct 2006
    Posts
    4
    Thanks Patrick for asking. I just need to put the results into another table. However, I would like to include enough comments around each SELECT statement for others to understand and use, something I cannot do with pre-saved queries.

    Thanks.

    Chris

  4. #4
    Join Date
    Oct 2006
    Posts
    4
    Thanks Patrick for asking. I just need to put the results into another table. However, I would like to include enough comments around each SELECT statement for others to understand and use, something I cannot do with pre-saved queries.

    Thanks.

    Chris

  5. #5
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Chris,

    Quote Originally Posted by championss
    Thanks Patrick for asking. I just need to put the results into another table.
    In that case, you do not really want a SELECT query--you either want INSERT or SELECT...INTO (otherwise known as "make-table").

    Quote Originally Posted by championss
    However, I would like to include enough comments around each SELECT statement for others to understand and use, something I cannot do with pre-saved queries.
    VBA treats anything after a single-quote as a comment.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 0
    Last Post: 04-04-2008, 03:43 PM
  2. code help for updat query
    By Grant in forum Queries
    Replies: 1
    Last Post: 01-31-2008, 05:53 AM
  3. SELECT FUNCTION help please
    By scott munkirs in forum Queries
    Replies: 0
    Last Post: 10-17-2006, 07:44 AM
  4. Replies: 3
    Last Post: 04-05-2006, 04:17 PM
  5. Replies: 0
    Last Post: 11-28-2005, 01:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums