Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Startup connection to SQL Server 1

Status
Not open for further replies.

ericksoda

Programmer
Oct 22, 2001
60
0
0
US
I have an .ADP application that I distribute to my customers. Is there a way the program can ask for connection data on startup? I have trouble talking them through the connection process when they first open the program.

Thanks!

David
 
You can define your ADO-Connection with the OpenConnection-Method from the CurrentProject-Object.

see
I found little information about this, but you can use this method to set the database(connection) and the user + password.

just use:
[tt]CurrentProject.OpenConnection connectionstring, user, password[/tt]

for the connectionstring just use a configured adp, and copy the string from the result of
[tt]debug.print CurrentProject.Connection[/tt]

(as you can see this string also includes the databasename, perhaps you may want to change it for some reason, here you can do it...)

user is a user on the SQL-Server,
pw is the password for the user.

Use this method to built a self-made user-login or to set the connection in a startup-form.

You can check for connection with
[tt]CurrentProject.IsConnected [/tt]

hope this helps,
greetings from Germany,
Jens
 
Danke Schoen, Jens.

Do you know if there is an trigger/method for on Database open? What I want is to trap the initial connection and then set it with the code you suggest. I have looked, but can't find where the .ADP startup method is.

Thanks for your help!

Greetings from Oregon (just north of California)

David
 
Never mind. I just looked some more and found that the form I set in the Tools>Startup is where the login comes from. So I can set it there. I was looking for the wrong thing (again.)

Thanks for your help,

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top