473,326 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Create DSN-Less connection to SQL 2005 with DAO

Hello,

Is it possible to create a DSN-less connection to a table in SQL
Server 2005 using DAO in Access 2003? I tried what I thought was
pretty standard code but every time I run it it still prompts me for a
DSN:

Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim strConnect As String

' note - username and password below are changed...
strConnect = "ODBC" & _
";DRIVER = SQL Server" & _
";SERVER = PEDSQL" & _
";DATABASE = CATI" & _
";UID = username" & _
";PWD = password;"

Set db = CurrentDb
Set tdf = db.CreateTableDef("AddressResponse")
tdf.SourceTableName = "AddressResponse"
tdf.Attributes = DB_ATTACHSAVEPWD
tdf.Connect = strConnect

db.TableDefs.Append tdf
db.TableDefs.Refresh

Set tdf = Nothing
Set db = Nothing

When I step through this code in the debugger I get prompted for a DSN
at the 'db.TableDefs.Append tdf' line. If I go ahead and select a DSN
here I am still prompted for user ID and password. If I enter the
user ID and password just as I specified them in strConnect it will go
ahead and create the link. Is there a way to create the link 'from
scratch' without prompting for a DSN? Any help greatly appreciated.
Thanks!

Bruce

Jul 16 '07 #1
0 1870

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Leader | last post by:
HI All, I created a SQL Server DSN using Windows ODBC Data Source Administrator. While creating the DSN, it asked me about authentication process in reply to which I selected "With SQL Server...
3
by: McCool | last post by:
How can I get the deployment project to setup a DSN pointing to an Access DB after installation takes place? Also, is there a way to kick off a vbs script after installation takes place through...
9
by: Albretch | last post by:
.. I am trying to create a database in a MS Access DB via JDBC drivers. I have tried both sun.jdbc.odbc.JdbcOdbcDriver and ids.sql.IDSDriver From some reason both drivers Exceptions tell me...
1
by: Bruce Lawrence | last post by:
I know this works for Access 97. Not sure about other versions. This will create a DSN to a SQL server in your ODBC connections and then link a table of your choise from that SQL DB to the...
4
by: Steve Sweales | last post by:
I'm trying to find some code on how to create a DSN using C# and SQLConfigDataSource. Can anybody help me please, before I tear my hair out!! *** Sent via Devdex http://www.devdex.com ***...
8
by: DerekS | last post by:
Hi, I've been pulling my hair out trying to write a simple method to programatically create a system DSN with all parameters on a remote machine. I have ensured I have the correct permissions on...
2
by: K. A. | last post by:
I'm trying to write a web site for storing staff ID's together with their photos using a PHP form. A user of the site should be able to enter his ID, name, and select a file from a directory as his...
2
by: Dale Sampson | last post by:
My app uses an ODBC connection for a .mdb file. I want the app to create the source if it does not already exist (I copy a blank .mdb file to the users data store if it doesn't exist). I see how...
0
by: senthildb2 | last post by:
Hi there, I want to create DSN for DB2 database through my VB application. I have installed DB2 v8.2 with FixPack6.0 ESE. (The actual version shown in Control Center is DB2 V8.1.13.193) The...
0
by: mrsea001 | last post by:
I am using DSN for Crystal Report. So I want support for creating DSN through my Applicatin Setup. Therefore when user installs my application setup should ask for DSN properties e.g:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.