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!

global connection string in vba for sql server 1

Status
Not open for further replies.

JacobTechy

Programmer
Apr 14, 2005
181
0
0
US
I have the connection string below in the open event of my form which works when I initially open the form, but when I click on a drop down box within that same form also pulling data from our sql server I get the sql server login using trusted connection window pop up. How can I make this connection string global. I have a ms access interface to sql server backend.

Dim Connect As String
Connect = "Driver={SQL Server};Server=servername;Database=dbasename;UID=;PWD=
 
you could make it a GLOBAL variable but do you really want to keep the connection open all the time ?

I would keep the connection as a string in a global variable and then simply reference it when you want to open the connection

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top