expected:end of statement

  • Thread starter kennytwk via AccessMonster.com
  • Start date
K

kennytwk via AccessMonster.com

hi everyone, my error point to this "SELECT LoginTable.Username FROM
LoginTable", i don't think there is anything wrong with it, can anyone give
me some idea, many thanks in advance.

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 str1 As String
Dim cnn1 As ADODB.Connection
Dim rst1 As Recordset

str1 = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\db1.mdb;"

Set cnn1 = New ADODB.Connection
cnn1.Open str1

Set rst1 = New ADODB.Recordset
rst1.ActiveConnection = cnn1

UsrNme = rst1.Open "SELECT LoginTable.Username FROM LoginTable", , , ,
adCmdText

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top