Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 04-24-2009, 09:07 AM
Novice
 
Join Date: Jan 2009
Posts: 6
pushpm is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 04-24-2009, 10:20 AM
CraigDolphin CraigDolphin is offline Windows XP Access 2000 (version 9.0)
Advanced Beginner
 
Join Date: Apr 2009
Location: Custer, WA, USA
Posts: 85
CraigDolphin is on a distinguished road
Default

Is this a question?
Reply With Quote
  #3  
Old 05-06-2009, 06:36 AM
tinytree tinytree is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Apr 2009
Posts: 28
tinytree is on a distinguished road
Default

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
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Designing query to select entries with 6 of 9 columns greater than 3 mrc881 Queries 0 04-03-2009 11:15 AM
Select query for Exponential Moving Average. krishna79 Queries 0 01-22-2009 02:52 AM
Select query with two criteria corni Queries 1 01-22-2009 02:23 AM
very difficult (for me!) SELECT query igorbaldacci Queries 1 12-02-2008 12:30 PM
Using SELECT query within a VBA code in Access championss Programming 4 10-23-2006 03:50 PM


All times are GMT -8. The time now is 02:58 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.