Consulting

Results 1 to 6 of 6

Thread: Connection String in Excel VBA

  1. #1

    Smile Connection String in Excel VBA

    I am currently developing a VBA program that automatically connects the pivot table to an MS Access database. My problem is how can I make my program flexible to handle different databases like SQL Server or Oracle. Is it possible to generate a different connection string at run time?

    Any help will be appreciated.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Of course it is.

    Create separate sub-routines with the different connection strings setup, and call the appropriate one at runtime.

    You will have to determine how that decision is made.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Thanks xld, but is it possible to make more flexible like a connection builder.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You would need to elaborate what you mean by that.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Mentor anandbohra's Avatar
    Joined
    May 2007
    Location
    Mumbai
    Posts
    313
    Location
    hope this will help u to quickly recall the connection string code

    HTML Code:
    http://www.connectionstrings.com/

  6. #6
    Thank you guys for the help. I am sorry if I didn't make myself clear here. Fortunately, I solved this problem already. Here's the link of the solution: Building Database Connection String Programmatically

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •