Link to home
Start Free TrialLog in
Avatar of ellandrd
ellandrdFlag for Ireland

asked on

AfterUpdate event error Urgent 500 points

have a combo box on a form the has an afterupdate event that populates an other combo box on a subform

The after update is below

I have ran the select statement in a querry and it works when i manualy enter the number.

The error i get syntax error (missing Operator) in querry expression 'tblCost.PersonnelID Where (tblCost.PersonnelID)= 1'.

Me!fsubTimeEntry!cboCostRateId.RowSource = "SELECT tblRateTypes.RateDescription, Max(tblCost.CostId) AS CostId, tblCost.RateID, Max(tblCost.Rev) AS MaxOfRev, Max(tblCost.Rate) AS MaxOfRate, tblCost.PersonnelID FROM ((tblCost LEFT JOIN tblEmpTerm ON tblCost.EmpTermID = tblEmpTerm.EmpTermID) LEFT JOIN tblPersonnel ON tblCost.PersonnelID = tblPersonnel.PersID) LEFT JOIN tblRateTypes ON tblCost.RateID = tblRateTypes.RateId GROUP BY tblRateTypes.RateDescription, tblCost.RateID, tblCost.PersonnelID WHERE(tblCost.PersonnelID) = " & Me.cboPersonnelID

So the querry works but i cant get it to work with the form and subform
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi ellandrd,
In the code you posted there is no space after WHERE.  If that's the case in your real query then add one.

Pete
Avatar of ellandrd

ASKER

put the space in still the same error
ASKER CERTIFIED SOLUTION
Avatar of david251
david251

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awsome thank you but i havnt seen that before where the WHERE has to move.

Any reason why?
Avatar of david251
david251

Glad I could help,

To answer your question, here is the format for sql statments. If it is not in this order you will get an error

Select
From
   Join
    on
Where
Group by
Having

Thanks for the points/grade.

-David251