Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 17th, 2005, 05:38 PM
t_neustel t_neustel is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 9 t_neustel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 49 m 8 sec
Reputation Power: 0
Lightbulb Access connecting to SQL Server

Hello Forum,

I am attempting to utilize an Access db to view/report/analyze data from a few SQL Server Databases.
I know that you can connect via ODBC but I have several workstations/remote desktop logins that may be using this database.

Does anyone know any other ways (ADO?) to connect to a SQL Server database and if so can it be automatically programmed
login or workstation?

Thank you for your time and in advance for any help you may be able to toss my way.....

t_neustel

Reply With Quote
  #2  
Old March 21st, 2005, 11:11 AM
SPARKER SPARKER is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 2 SPARKER User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 35 sec
Reputation Power: 0
Smile ADO Connection Strings:

'XXXXXXXXXXXXXXXXXXXXXXXXX_CREATE~CONNECTION_XXXXX XXXXXXXXXXXXXXXXXXXXXX
Global gconMyConnection As ADODB.Connection
Global Const gstrMyConnectionString = "Provider=sqloledb;" & _
"Data Source=(SQL_SERVER_NAME_GOES_HERE);" & _
"Initial Catalog=SQL_SERVER_DATABASE_NAME_GOES_HERE;" & _
"Integrated Security=SSPI;"
Set gconMyConnection = New ADODB.Connection
With gconMyConnection
.ConnectionString = gstrMyConnectionString
.CursorLocation = adUseServer
.Open
End With
'XXXXXXXXXXXXXXXXXXXXX_USE~CONNECTION~STORED~PROCE DURE_XXXXXXXXXXXXXXXXXXX
Dim pstrSQL As String
Dim pADOCommand As New ADODB.Command

' Run SQL_Server stored procedure from access
With pADOCommand
.ActiveConnection = gconMyConnection
.CommandType = adCmdStoredProc
.CommandText = "My_Stored_Procedure"
.Parameters.Refresh
.Parameters(1) = MyVariable#1
.Parameters(2) = MyVariable#2 etc...
.Execute
End With
'XXXXXXXXXXXXXXXXXXXXX_USE~CONNECTION~SQL~RECORDSE T_XXXXXXXXXXXXXXXXXXX
' Set SQL statement for ADO Query Recordset
pstrSQL = "SELECT TheData " & _
"FROM ThisTable " & _
"GROUP BY This, That, TheOther " & _
"ORDER BY This"

Set grsTimeSheets = New ADODB.Recordset
With grsTimeSheets
.ActiveConnection = gconMyConnection
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.Source = pstrSQL
.Open
If .EOF And .BOF Then Exit Sub
End With
'XXXXXXXXXXXXXXXXXXXXX_HOPE~THAT~HELPS~_XXXXXXXXXX XXXXXXXXX

'XXXXXXXXXXXXXXXXXXXXX_~SPARKER~_XXXXXXXXXXXXXXXXX XX


Quote:
Originally Posted by t_neustel
Hello Forum,

I am attempting to utilize an Access db to view/report/analyze data from a few SQL Server Databases.
I know that you can connect via ODBC but I have several workstations/remote desktop logins that may be using this database.

Does anyone know any other ways (ADO?) to connect to a SQL Server database and if so can it be automatically programmed
login or workstation?

Thank you for your time and in advance for any help you may be able to toss my way.....

t_neustel

Reply With Quote
  #3  
Old March 22nd, 2005, 05:44 PM
t_neustel t_neustel is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 9 t_neustel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 49 m 8 sec
Reputation Power: 0
ADO Connection Strings

Yes...That helps quite a bit...I found the answers as well...but your code seems very explanatory...Thanks!!

Have you ever tried to access a "View" from a SQL Server. I thought this might be the solution because one of the recordsets I am trying to get info from has 7 million records and that wouldn't be good for Access to crunch! So we thought a view from the SQL Server database might do the trick.

THanks again!!

t_neustel

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Access connecting to SQL Server


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 12 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek