- Q & A
- ask question
- log In
- Copyright 2014
- © ConnectionStrings.com
- All Rights Reserved
- Powered by CSAS
- With support from Contributing Developers and Windward Reports
Here's the setup:
MS Access has a linked table to SQL Server. SQL Server has a password on it. Trying to use Excel VBA to query this linked table in Access, but I can't get the connection string correct. I can connect from Excel to Access, or from Excel to SQL Server, but I can't figure out how to go Excel --> MS Access --> SQL Server. Need help.
Thanks for your time.
Cory0 asked Cory No
Please share the connection strings you are using. There are two separate right? One for Excel -> Access and one for Access -> SQL Server.
Is there any error? Please update your with error messages. Or specify more precisely the problem / what's happening when connecting? Right now it's a bit to vague I think...0 Max Wikström
Ooop. Sorry about that. I only have one connection string (from Excel to Access, with Access already having a linked table to SQL Server established). I'm not sure how to add a second connection string. Basically, when I go to open the linked table in Access, a prompt window pops up that asks for the Login ID and Password for the SQL Server. Here's the code I'm using so far:
Function DatabaseCall2(ByVal sSQL1 As String) As ADODB.Recordset Dim Cn As ADODB.Connection Dim RS as ADODB.RecordSet Dim ConnectionString As String Set Cn = New ADODB.Connection 'DSN=FIDM_Reporting 'DATABASE=fi_analytics_reporting ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=FIDM_Reporting;" & _ "User ID=UserNameHere;Password=Passwordhere" Cn.ConnectionString = ConnectionString Cn.Properties("Prompt") = adPromptAlways Cn.Open // Will add code here to execute SQL statement and assign RS, but I haven't gotten past the previous step End function
When I run this code, I get the prompt that asks for Data Source, User Name, Password, Provider String, and Open Mode. I've been Googling this for a few hours, and I'm not sure what to put in for Data Source. Is it the SQL Server DSN? What about Provider String?0 Cory No
Remove (or comment out) the line
Cn.Properties("Prompt") = adPromptAlways
to get rid of the prompt. (cause its the prompting thats your problem right?)0 Max Wikström
I am using vb.net and I try to insert from my web in visual studio to my sql DB but it does not work also there is no any Error pleas help me " Imports System.Data Imports System.Data.SqlClient
Good morning, I'm new here, live in Venezuela, glad to know about you, come here to solve a problem with a connection between a Visual Basic 6, and Sql Server 2000, converted my Access database to Sql database with Access, .adp, and move to Sql server 2000 with access2003.
Hello; I has and old web application begin with windows 2000 and SQL 200. Then Windows 2003 and SQL 2005. In the 2 scenarios I change in this string the data source (server name and the password and then work fine.
Hello All, I am facing one issue like "External table is not in the expected format." with 2013 micro enable excel . when i am trying to open the connection string for reading the excel file i.e oleConn.Open(); .
hi friends i want create a connection string to a sql server database by asking connection string parameter values from user in a cosole application?? anyone can help me on this ??
We're trying to reconcile what we see under the "ODBC Administrator" application for Windows 7/8 versus what has been referenced on this site under the following drivers/providers:
I need to connect netezza from EXCEL. When I am going (DATA --FROM OTHER SOURCES --FROM DATA CONNECTION WIZARD--Other/Advance--IBM NATEZA OLE DB DATA PROVIDOR --(In Data source I am putting IP , and user name and password) but it is not working.
I have a VB6 application that runs correctly from the system that contains the sql server and the source code, either when compiled as an exe or directly from the VB6 developer. It uses this connection string.
Hi, I am fairly new to VBA I have some syntax problems that I do not understand with the connection strings that you give. For example for XL 2007 With the following, the first ( which you give ) and the Third give Syntax errors.
Can anyone share the syntax for a SQL connection string that has variables for the different parameter values? Need to pass the values of some textbox fields into the connection string but I get an End of Statement Expected Error with my string in Visual Studio 20102: