Ado

rwahdan

New member
Local time
Today, 06:52
Joined
Feb 11, 2006
Messages
9
Hi,

i am trying to use recorsets and i get an error and i am not sure what is the problem! maybe i am missing a referance or the code have something wrong that i cant see! please help! the code is below:

Private Sub cmdLogin_Click()
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
Dim strSql As String
strSql = "SELECT tblEmployees.[strAccess]" & _
"FROM tblEmployees;" & _
"where tblEmployees.[lngEmpID]='" & Me.cboEmployee.Value & "';"
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open ("c:\login.mdb")
rs.Open strSql, cn
Do While Not rs.EOF
MsgBox rs!strAccess
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub

the screenshot error is below:

http://img216.imageshack.us/my.php?image=image001sw3.png

thanks.
 
You have an extra semilcolon - take the one out on the from line.

strSql = "SELECT tblEmployees.[strAccess]" & _
"FROM tblEmployees " & _
"where tblEmployees.[lngEmpID]='" & Me.cboEmployee.Value & "';"
 

Users who are viewing this thread

Back
Top Bottom