I got this code from www.planetsourcecode.com and I was wondering exactly where to put it and how to use it, because they weren't very clear.

Public Sub CONNECTODBC()
Dim dbname As String
Dim dataset As String
Dim User3 As String
Dim pass As String
Dim db As Database
Dim X As String
User3 = "USERID"
pass = "PSWD"
dataset = "YOUR DSN NAME"
dbname = "DATABASE NAME"
X = "ODBC;database=" & dbname & ";DSN=" & dataset & ";UID=" & User3 & ";PWD=" & pass
Set db = OpenDatabase("", False, False, X)
db.Close
End Sub

If you could help me figure out exactly how to use it, or figure out a better way to connect to a SQL server, I would appreciate it.


------------------
Thanks,
Ryan
[email protected]
ICQ# 47799046