Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296

    Do I need to setup an ODBC connection in the windows ODBC Data Sources to use ODBC in access?

    Hi, Basically what the title says.
    An application I am developing uses
    Code:
    DoCmd.TransferDatabase acLink, "ODBC Database", strConnect, acTable, Tablename(i), Tablename(i)
    and I was wondering if I need to go onto every computer that will use it and setup an ODBC connection in the windows ODBC Data Sources or if maybe I could use a different method of retrieving the tables and setting them up as linked tables?



    I don't believe it is an issue with the connection string as when I setup a connection inside ODBC Data Sources everything worked fine but regardless here is my connection string:
    Code:
    strConnect = "ODBC;Driver={ODBC Driver 11 for SQL Server};Server=ServerName;Database=DBname;Network=DBNMPNTW;UID=UID;PWD=PWD;"
    The TableName(i) is just to cycle through a multidimensional variable(if that's what you call it? please correct my terminology if I'm wrong)
    Code:
    Dim TableName(0 To 6) As String
    Thanks!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    windows start,
    ODBC
    add the odbc connection details (say: MyOdbc)
    then in access, external data
    get SQL server (or other db)
    Link tables
    choose MyOdbc.
    select all the tables you want to use.

  3. #3
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by ranman256 View Post
    windows start,
    ODBC
    add the odbc connection details (say: MyOdbc)
    then in access, external data
    get SQL server (or other db)
    Link tables
    choose MyOdbc.
    select all the tables you want to use.
    I was asking if I need to add the connection details in windows or if I can set it up in access so that it doesn't need that because doing that on every computer is a hassle and it seems like there would be a different way.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Need on each computer.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by June7 View Post
    Need on each computer.
    Yes? Am I phrasing something wrong here? or misunderstanding?
    If I use
    Code:
    Driver={sql server}
    instead it seems to work between computers perfectly fine but I was informed I shouldn't do this?

    Edit: Not intending to be rude. I am just trying to figure out a way to do this so that I don't have to go to 50+ computers and setup an odbc connection. That is why I have been trying to use a DSN-less connection.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Sorry, yes, if you want to use DSN-less and VBA code to establish connection, that is possible. I have that setup on my laptop. I am not sure what the drawbacks could be on a LAN.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    You do not need to set up a DSN on each computer for sure; but what you need is to have the same driver installed on each computer. "SQL Server" driver is the legacy driver that comes with Windows and is installed by default on each Windows machine, that is why it works. But it is a very old driver and most developers recommend using one of the latest ones.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  8. #8
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    As per Gicu above, I would install a later driver than the default one. You will need that on every client machine.

    You can write code that can interrogate the drivers that are installed on a machine and set the connection string appropriately, but it's much easier to have a consistent driver, and avoid any issues with compatibility and performance.
    In a corporate environment you can push out a suitable driver using group policy.

    We use Version 17 and are slowly migrating to version 18 where we can with our clients.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  9. #9
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by Gicu View Post
    You do not need to set up a DSN on each computer for sure; but what you need is to have the same driver installed on each computer. "SQL Server" driver is the legacy driver that comes with Windows and is installed by default on each Windows machine, that is why it works. But it is a very old driver and most developers recommend using one of the latest ones.
    Cheers,
    So that's the weird thing. When I open ODBC Data Sources and click add, they both have "SQL Server Native Client 11.0" Version 2011.110.7462.06 with the same file name and date.
    Yet When I was using "Driver={ODBC Driver 11 for SQL Server}" It worked on the development computer but not the test computer. I was getting an error 3151 ODBC Connection failed. Changing to "SQL Server" has since fixed the issue.

    Quote Originally Posted by Minty View Post
    As per Gicu above, I would install a later driver than the default one. You will need that on every client machine.

    You can write code that can interrogate the drivers that are installed on a machine and set the connection string appropriately, but it's much easier to have a consistent driver, and avoid any issues with compatibility and performance.
    In a corporate environment you can push out a suitable driver using group policy.

    We use Version 17 and are slowly migrating to version 18 where we can with our clients.
    I am very interested on how to do this. I don't plan on integrating it but it sounds interesting!

  10. #10
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by June7 View Post
    Sorry, yes, if you want to use DSN-less and VBA code to establish connection, that is possible. I have that setup on my laptop. I am not sure what the drawbacks could be on a LAN.
    I thought I responded to this with the above info but I guess I forgot, my bad! What do you mean by drawbacks on LAN? I know there are some differences but I feel like just file sharing via ODBC would act the same as an internet connection no?

  11. #11
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    So that's the weird thing. When I open ODBC Data Sources and click add, they both have "SQL Server Native Client 11.0" Version 2011.110.7462.06 with the same file name and date.
    Yet When I was using "Driver={ODBC Driver 11 for SQL Server}" It worked on the development computer but not the test computer. I was getting an error 3151 ODBC Connection failed. Changing to "SQL Server" has since fixed the issue.
    Those are two different drivers:
    https://social.msdn.microsoft.com/Fo...qldriverforphp
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  12. #12
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by Gicu View Post
    You know what, I didn't even notice the development computer had that ODBC driver installed. I was so hyper focused on using the SQL Server 11 one because that's what I was told is on every computer and then I misused connectionstrings.com I guess. Can I just enter the name of that driver into the brackets and it will select it?

  13. #13
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    The driver has to be installed on the host computer, it won't just work by changing the connection string.
    The ones I currently check / use depending on the age of the app are;

    "SQL Server Native Client 11.0"
    "ODBC Driver 11 for SQL Server"
    "ODBC Driver 13 for SQL Server"
    "ODBC Driver 17 for SQL Server"
    "ODBC Driver 18 for SQL Server"


    I can't share the code unfortunately as it belongs to a client, but it does involve enumerating through registry entries.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  14. #14
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by Minty View Post
    The driver has to be installed on the host computer, it won't just work by changing the connection string.
    The ones I currently check / use depending on the age of the app are;

    "SQL Server Native Client 11.0"
    "ODBC Driver 11 for SQL Server"
    "ODBC Driver 13 for SQL Server"
    "ODBC Driver 17 for SQL Server"
    "ODBC Driver 18 for SQL Server"


    I can't share the code unfortunately as it belongs to a client, but it does involve enumerating through registry entries.
    You can retrieve registry entries in Access? Would you be able to elaborate on how it functions at all? I imagine its just a for loop that enumerates through registry files to check if they are the same as any of the predefined driver names listed above.
    I don't know enough about registry files though or how you would retrieve them.
    I apologize if I am pushing a little, its just that this is interesting and opens my mind to so many other possibilities. Gotta get those tools for my toolbelt ya know? and thank you for whatever information you can give! I always learn great stuff here.

  15. #15
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. ODBC Data Source (ODBC or SQl Native Client)
    By DLTaylor in forum SQL Server
    Replies: 4
    Last Post: 11-07-2018, 06:36 AM
  2. Replies: 3
    Last Post: 04-25-2018, 10:32 AM
  3. Replies: 1
    Last Post: 04-21-2015, 10:20 AM
  4. Replies: 1
    Last Post: 03-02-2015, 09:44 AM
  5. Replies: 5
    Last Post: 10-25-2011, 08:01 AM

Tags for this Thread

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