Results 1 to 3 of 3
  1. #1
    pushpm is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2009
    Posts
    9

    VBA Script to run select query

    Dim cmd As ADODB.Command
    Dim strQueryText As String


    cmd.ActiveConnection = CurrentProject.Connection

    cmd.CommandType = adCmdText
    strQueryText = "SELECT Store_Profile.SPStoreNo, Store_Profile.SPSiteNo, Contact_Profile.CPExtAcctPhoneNo, Contact_Profile.CPExtAcctFaxNo"


    strQueryText = strQueryText & "FROM Contact_Profile INNER JOIN Store_Profile ON Contact_Profile.SPStoreNo=Store_Profile.SPStoreNo" & ";"
    cmd.CommandText = strQueryText

    cmd.Execute

    End Sub

  2. #2
    CraigDolphin is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Apr 2009
    Location
    Custer, WA, USA
    Posts
    125
    Is this a question?

  3. #3
    tinytree is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2009
    Posts
    28
    Maybe you want to get a recordset to save the result of the cmd.execute?
    You can define a recordset.(for example, name is rst)
    set rst=cmd.execute

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

Similar Threads

  1. Replies: 0
    Last Post: 04-03-2009, 01:15 PM
  2. Select query for Exponential Moving Average.
    By krishna79 in forum Queries
    Replies: 0
    Last Post: 01-22-2009, 05:52 AM
  3. Select query with two criteria
    By corni in forum Queries
    Replies: 1
    Last Post: 01-22-2009, 05:23 AM
  4. very difficult (for me!) SELECT query
    By igorbaldacci in forum Queries
    Replies: 1
    Last Post: 12-02-2008, 03:30 PM
  5. Using SELECT query within a VBA code in Access
    By championss in forum Programming
    Replies: 4
    Last Post: 10-23-2006, 05:50 PM

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