PDA

Click to See Complete Forum and Search --> : Filtering records in a recordset(SQL)


Jan 25th, 2000, 08:15 PM
Hi,
I am using SQL command to Filter records in "Orders" table so that I can have list of Orders placed by individual employee . I also have "Employees" table with a Combobox populated with "employeenames". These two tables are linked by their "employeeID". I am having problem filtering the "Orders" table when I click on the combobox on the "Employees" table. When I click the combobox, I get an error "Type mis-march" on the SQL statement. Attached is part of the code. Any help would be appreciated. Thanks.

Albert

Private combo1_click()

SQLconnect = "Select OrderID,OrderDate from Employees, Orders Where Employees.[EmployeeID] = Orders.[EmployeeID]" _
And "Lastname='" & Combo1.Text & "'"

Load Form2
Form2.Show

End Sub

Jan 25th, 2000, 10:04 PM
SQLconnect = "Select OrderID,OrderDate from Employees, Orders Where Employees.[EmployeeID] = Orders.[EmployeeID]" _
And "Lastname='" & Combo1.Text & "'"

Should be

SQLconnect = "Select OrderID,OrderDate from Employees, Orders Where Employees.[EmployeeID] = Orders.[EmployeeID]" _
& " And Lastname='" & Combo1.Text & "'"

------------------

Vincent van den Braken
EMail: azzmodan@azzmodan.demon.nl
ICQ: 15440110 (http://www.icq.com/15440110)
Homepage: http://www.azzmodan.demon.nl