|
-
Jul 24th, 2003, 09:48 AM
#1
Thread Starter
New Member
OpenRecordset Method
Can anyone help me with this code, tell me where im goign wrong.
[vb]
Dim rec As Recordset, query As String, db As Object
query = "SELECT EmployeeID , FirstName , LastName " _
& "FROM Employee " _
& "WHERE DepartmentName = '" & deptComboBox.Text & "';"
Set db = Application.CurrentDb
Set rec = db.OpenRecordset(query, 1)
[/vb]
This gives the error :
"Run-time error '3011':
The Microsoft Jet engine could not find the object 'SELECT EmployeeID, FirstName, LastName FROM Employee WHERE DepartmentName = 'Finance';'. Make sure the object exists and that you spell its name and path name correctly"
This is for a form in Access. I have run the query in Access and it gives the correct results so the query is correct.
I am in desperate need of help.
Thanks in advance
Andy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|