Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

AfterUpdate event error Urgent 500 points

Posted on 2005-02-28
5
Medium Priority
?
212 Views
Last Modified: 2008-03-06
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
0
Comment
Question by:ellandrd
  • 2
  • 2
5 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 13420382
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
0
 
LVL 16

Author Comment

by:ellandrd
ID: 13420411
put the space in still the same error
0
 
LVL 19

Accepted Solution

by:
david251 earned 2000 total points
ID: 13420416
Try changing it to:

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 WHERE(tblCost.PersonnelID) = " & Me.cboPersonnelID & " GROUP BY tblRateTypes.RateDescription, tblCost.RateID, tblCost.PersonnelID "

-David251
0
 
LVL 16

Author Comment

by:ellandrd
ID: 13420446
Awsome thank you but i havnt seen that before where the WHERE has to move.

Any reason why?
0
 
LVL 19

Expert Comment

by:david251
ID: 13420475
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
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question