
Problem with ODBC Connect!!!!
Well, this is the little problem I have:
Form: collects userid and password from user, after user enters data and
hits ok the following code should run:
Private Sub OKComando_Click()
On Error GoTo ErrorCatcher
Dim mydb As Database
Dim theset As QueryDef
Dim theone As Recordset
Dim strsql As String
Dim myUserid As String
Dim myPswd As String
myUserid = Me![userID]
myPswd = Me![Password]
Set mydb = CurrentDb()
Set theset = mydb.CreateQueryDef("quer11")
theset.Connect = "ODBC; DSN = eldb2con; DATABASE = eldb2con;uid=" &
myUserid & ";" & "pwd=" & myPswd & ";"
theset.SQL = "select * from sysdba.tsa_file_dly where cmpl_dt =
'980115'"
Set theone = mydb.OpenRecordset("quer11")
Do While Not theone.EOF
Debug.Print theone!host_id & " " & theone!cmpl_dt
theone.MoveNext
Loop:
Set mydb = Nothing
Login_mcr_cancel_Exit:
Exit Sub
ErrorCatcher:
MsgBox Error$
Resume Login_mcr_cancel_Exit:
End Sub
But I get stucked in the ODBC connect part, can somebody shine some light on
this problem
Thanks
Skar