K
kennytwk via AccessMonster.com
hi, i have create a connection to my database, now i am trying to make a
query, please see the
"-->", i wanted to store the whole column in UsrNme, i have a table name
LoginTable with 2 column (Username, Password), my form have 2 textbox (usrnm,
pssword), the message box and the remark at the IF statement is for my
program debugging, please let me know where have i gone wrong, many thanks,
and is there another way to make a connection (not using pathname)
Private Sub lgin_Click()
On Error GoTo Err_lgin_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim UsrNme As String
Dim PssWrd As String
Dim cnn1 As New Connection
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\db1.mdb;"
Set rst1 = New ADODB.Recordset
rst1.CursorType = adOpenKeyset
rst1.LockType = adLockReadOnly
MsgBox "NOK", vbOKOnly
rst1.Open "LoginTable", cnn1
--> UsrNme = SELECT Username
MsgBox "" & UsrNme, vbOKOnly
'If (UsrNme(a) = Me.usrnm & PssWrd(b) = Me.pssword) Then
' stDocName = "Project"
' DoCmd.OpenForm stDocName, , , stLinkCriteria
'Else
' MsgBox "OK", vbOKOnly
'End If
rst1.Close
cnn1.Close
Set rst1 = Nothing
Set cnn1 = Nothing
Exit_lgin_Click:
Exit Sub
Err_lgin_Click:
MsgBox Err.Description
Resume Exit_lgin_Click
End Sub
query, please see the
"-->", i wanted to store the whole column in UsrNme, i have a table name
LoginTable with 2 column (Username, Password), my form have 2 textbox (usrnm,
pssword), the message box and the remark at the IF statement is for my
program debugging, please let me know where have i gone wrong, many thanks,
and is there another way to make a connection (not using pathname)
Private Sub lgin_Click()
On Error GoTo Err_lgin_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim UsrNme As String
Dim PssWrd As String
Dim cnn1 As New Connection
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\db1.mdb;"
Set rst1 = New ADODB.Recordset
rst1.CursorType = adOpenKeyset
rst1.LockType = adLockReadOnly
MsgBox "NOK", vbOKOnly
rst1.Open "LoginTable", cnn1
--> UsrNme = SELECT Username
MsgBox "" & UsrNme, vbOKOnly
'If (UsrNme(a) = Me.usrnm & PssWrd(b) = Me.pssword) Then
' stDocName = "Project"
' DoCmd.OpenForm stDocName, , , stLinkCriteria
'Else
' MsgBox "OK", vbOKOnly
'End If
rst1.Close
cnn1.Close
Set rst1 = Nothing
Set cnn1 = Nothing
Exit_lgin_Click:
Exit Sub
Err_lgin_Click:
MsgBox Err.Description
Resume Exit_lgin_Click
End Sub