I have a data control on a form which is used to link to an Access Db.
In the formload event of the form I have the following code:
Set dbs = OpenDatabase("c:\my documents\employees.mdb")
In the general declarations section:
Dim dbs As Database
Dim rst As Recordset
And in a command button:
Private Sub Command1_Click()
Set rst = dbs.OpenRecordset("SELECT tbldept.DeptNumber, tbldept.DeptName, " _
& "tblemployees.EmpNumber, tblemployees.EmpName, tblemployees.EmpTitle, " _
& "FROM tbldept INNER JOIN tblemployees ON " _
& "tbldept.DeptNumber = tblemployees.EmpDeptNumber, " _
& "WHERE DeptNumber ='" & Text1.Text & "' ;")
I cannot get the SQL coded properly. The error is 3141.
What is wrong with the SQL?