Monday, March 12, 2012

Newbie help On Sql string form vb

HI, I just started db programming for this project I am working on. I am having a problem joining two tables where both of their "EmployeeID" fields is equal to my Vb EmpID string...

I was trying the code:

SqlQuery = "SELECT TblEmpAttendance.Date, TblEmpAttendance.Value," & _
"TblEmployees.TotalPoints, TblEmployees.DaysWorked FROM TblEmployees RIGHT JOIN TblEmpAttendance ON TblEmployees.EmployeeID WHERE TblEmpAttendance.EmployeeID" & _
"= TblEmpAttendance.EmployeeID AND TblAttendance.EmployeeID=" & EmpID

Any help would be appreciated.
Thanks
-Greg S.Oops I already posted it but ill dbl chk anyhow. I got it to work using:

SqlQuery = "SELECT TblEmpAttendance.EmployeeID, TblEmpAttendance.Date, TblEmpAttendance.Value," & _
"TblEmployees.TotalPoints, TblEmployees.DaysWorked FROM TblEmployees RIGHT JOIN TblEmpAttendance ON TblEmployees.EmployeeID = TblEmpAttendance.EmployeeID WHERE TblEmployees.EmployeeID = " & EmpID

Is their anyhting that could cause problems with this statement?
Thanks
-Greg S

No comments:

Post a Comment