Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql morphing in combo box: syntax error 1

Status
Not open for further replies.

simon551

IS-IT--Management
May 4, 2005
249
Hello,
I have a combo box on a subform that references a combo box on the main form in a query. The query works beautifully on it's own, but when I drop it in the combo, the sql gets mucked up for some reason and I get a syntax error in From Clause.

This is the original sql:
SELECT tblBillingCodeItems.BillingCodeItemID, tblBillingCodeItems.WorkDesc
FROM tblBillingCodeItems INNER JOIN ((SELECT tblEmployees.EmpID, tblGroups.GroupID
FROM tblGroups INNER JOIN tblEmployees ON tblGroups.GroupID = tblEmployees.DeptID
WHERE (((tblEmployees.EmpID)=[Forms]![frmTimesheet_ListViewMain]![EmpID]))) AS G)
ON tblBillingCodeItems.GroupID = G.GroupID;


This is after being changed. I've tried this over and over and have the same problem.


SELECT tblBillingCodeItems.BillingCodeItemID, tblBillingCodeItems.WorkDesc FROM tblBillingCodeItems INNER JOIN [SELECT tblEmployees].[EmpID, tblGroups].[GroupID FROM tblGroups INNER JOIN tblEmployees ON tblGroups].[GroupID = tblEmployees].[DeptID WHERE (((tblEmployees].[EmpID)=[Forms]]![frmTimesheet_ListViewMain]![[EmpID]))] AS G ON tblBillingCodeItems.GroupID=G.GroupID;


Any idea how to fix this bug? Thanks in advance!
 
You may try this RowSource:
SELECT tblBillingCodeItems.BillingCodeItemID, tblBillingCodeItems.WorkDesc
FROM (tblBillingCodeItems
INNER JOIN tblGroups ON tblBillingCodeItems.GroupID = tblGroups.GroupID)
INNER JOIN tblEmployees ON tblBillingCodeItems.GroupID = tblEmployees.DeptID
WHERE tblEmployees.EmpID = [Forms]![frmTimesheet_ListViewMain]![EmpID]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top