ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting data from SQL (https://www.excelbanter.com/excel-programming/362863-getting-data-sql.html)

[email protected]

Getting data from SQL
 
Hi,

I am trying to build a workbook with data from SQL. I need to prompt
the user for the SQL server, login and pwd (its in mixed mode)
everytime the workbook is opened.

I am new to this and I have explored the following options:

Building a login form and ADO recordsets

Using SQL.Request()

Our users are on various versions of Excel (all 2000+) so I want to
make sure it works for everyone.

thanks


AA2e72E

Getting data from SQL
 
Try this:

1. Create your ADO connection object.
2. Set its Properties.Prompt.Value = 1 ' adPromptAlways
3. Open your Connection object

An appropriate form will open up asking for the relevant/missing information.

Sub aa()
Set adoc = CreateObject("ADODB.Connection")
adoc.Properties("Prompt").Value = 1
adoc.Open
End Sub





All times are GMT +1. The time now is 05:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com