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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DSNLess connection SQL Server

Status
Not open for further replies.

pazgb

Programmer
Jun 9, 2003
60
US
I am trying to create a DSNLess connection from my database to another so I dont have to set up DSN connection on every PC that uses my database. So far i have the DSN connection working but like i said i would like a DSNLess connection


Global Const ConnectStringDSN = "ODBC;DSN=CPT;DATABASE=CONVERTING;UID=CONVERTING;PWD=TISSUE;"


Function SQL_preconnect()
On Error GoTo TrapError
Dim wrkRemote As Workspace, dbsRemote As Database
'Dim wrkRemote1 As Workspace, dbsRemote1 As Database

Set wrkRemote = DBEngine.Workspaces(0)
'Set wrkRemote1 = DBEngine.Workspaces(0)
'Set dbsRemote = wrkRemote.OpenDatabase("", False, False, ConnectStringDSNLess)
Set dbsRemote = wrkRemote.OpenDatabase("", False, False, ConnectStringDSN)
'Set dbsRemote1 = wrkRemote1.OpenDatabase("", False, False, ConnectStringDSN1)
dbsRemote.Close
'dbsRemote1.Close

Exit Function
TrapError:
ErrorHandler "SQL_preconnect"
Exit Function
End Function

Public Function ErrorHandler(ByVal strLocation As String)

MsgBox "Unanticipated Error Number " + CStr(Err.Number) + " occured: " + Err.Description + vbCrLf + "In: " + strLocation
Err.Clear

End Function


can anyone help me out?
 
You don't have to setup a DSN connection on every pc. What you probably did was either created a User DSN or System DSN. Try creating a File DSN and store the file on a server that everyone has access to.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top