#error on form expression.

G

Guest

I have the following query:
SELECT [hire dates].[lastname]+", "+[names] AS repname, Attendance.Date,
Attendance.Code, [Occurence Type].Points, Attendance.Hours,
Attendance.Comments, [Hire Dates].[Available Planned], [Hire
Dates].[Available Unplanned], [Hire Dates].EmployeeID
FROM [Hire Dates] INNER JOIN ([Occurence Type] INNER JOIN Attendance ON
[Occurence Type].Code = Attendance.Code) ON [Hire Dates].nnnn =
Attendance.Name
GROUP BY [hire dates].[lastname]+", "+[names], Attendance.Date,
Attendance.Code, [Occurence Type].Points, Attendance.Hours,
Attendance.Comments, [Hire Dates].[Available Planned], [Hire
Dates].[Available Unplanned], [Hire Dates].EmployeeID
HAVING ((([hire dates].[lastname]+", "+[names])=[Forms]![Names]![Name]) AND
((Attendance.Date) Between [forms]![name]![text17] And
[forms]![name]![text11]))
ORDER BY Attendance.Date;

I am trying to create a repor that will sum the hours used by repname for
specific codes. I continually receive the #ERROR. my expression is as follows
for the report:

=Dsum("[Hours]","[points query]","
Code:
='Planned' or 'planned time
unplanned' or 'PTU consecutive' or 'PTU less than full shift' or 'ptu less
than half shift'")
 
G

Guest

"[points query]" should not need the brakets around it.

You need to repeat
Code:
= in all your OR clauses.

"[Code]='Planned' or [Code]='planned time unplanned' or [Code]='PTU
consecutive' or [Code]='PTU less than full shift' or [Code]='ptu less than
half shift'")

or use an IN clause
"[Code] IN ('Planned', 'planned time unplanned', 'PTU consecutive', 'PTU
less than full shift', 'ptu less than half shift')")
 
G

Guest

Thanks, Jerry
it still didn't work.
i even tried "" around each OR statement after i tried the
Code:
 and that
didn't work.
i'm sure it'll come to me.



[QUOTE="Jerry Whittle"]
"[points query]" should not need the brakets around it.

You need to repeat [Code]= in all your OR clauses.

"[Code]='Planned' or [Code]='planned time unplanned' or [Code]='PTU
consecutive' or [Code]='PTU less than full shift' or [Code]='ptu less than
half shift'")

or use an IN clause
"[Code] IN ('Planned', 'planned time unplanned', 'PTU consecutive', 'PTU
less than full shift', 'ptu less than half shift')")

--
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


[QUOTE="Stacey G."]
I have the following query:
SELECT [hire dates].[lastname]+", "+[names] AS repname, Attendance.Date,
Attendance.Code, [Occurence Type].Points, Attendance.Hours,
Attendance.Comments, [Hire Dates].[Available Planned], [Hire
Dates].[Available Unplanned], [Hire Dates].EmployeeID
FROM [Hire Dates] INNER JOIN ([Occurence Type] INNER JOIN Attendance ON
[Occurence Type].Code = Attendance.Code) ON [Hire Dates].nnnn =
Attendance.Name
GROUP BY [hire dates].[lastname]+", "+[names], Attendance.Date,
Attendance.Code, [Occurence Type].Points, Attendance.Hours,
Attendance.Comments, [Hire Dates].[Available Planned], [Hire
Dates].[Available Unplanned], [Hire Dates].EmployeeID
HAVING ((([hire dates].[lastname]+", "+[names])=[Forms]![Names]![Name]) AND
((Attendance.Date) Between [forms]![name]![text17] And
[forms]![name]![text11]))
ORDER BY Attendance.Date;

I am trying to create a repor that will sum the hours used by repname for
specific codes. I continually receive the #ERROR. my expression is as follows
for the report:

=Dsum("[Hours]","[points query]","[Code]='Planned' or 'planned time
unplanned' or 'PTU consecutive' or 'PTU less than full shift' or 'ptu less
than half shift'")
[/QUOTE][/QUOTE]
 
G

Guest

I got it!. i used the IN clause in the front, and it worked! thank you, thank
you , thank you.

Jerry Whittle said:
"[points query]" should not need the brakets around it.

You need to repeat
Code:
= in all your OR clauses.

"[Code]='Planned' or [Code]='planned time unplanned' or [Code]='PTU
consecutive' or [Code]='PTU less than full shift' or [Code]='ptu less than
half shift'")

or use an IN clause
"[Code] IN ('Planned', 'planned time unplanned', 'PTU consecutive', 'PTU
less than full shift', 'ptu less than half shift')")

--
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


[QUOTE="Stacey G."]
I have the following query:
SELECT [hire dates].[lastname]+", "+[names] AS repname, Attendance.Date,
Attendance.Code, [Occurence Type].Points, Attendance.Hours,
Attendance.Comments, [Hire Dates].[Available Planned], [Hire
Dates].[Available Unplanned], [Hire Dates].EmployeeID
FROM [Hire Dates] INNER JOIN ([Occurence Type] INNER JOIN Attendance ON
[Occurence Type].Code = Attendance.Code) ON [Hire Dates].nnnn =
Attendance.Name
GROUP BY [hire dates].[lastname]+", "+[names], Attendance.Date,
Attendance.Code, [Occurence Type].Points, Attendance.Hours,
Attendance.Comments, [Hire Dates].[Available Planned], [Hire
Dates].[Available Unplanned], [Hire Dates].EmployeeID
HAVING ((([hire dates].[lastname]+", "+[names])=[Forms]![Names]![Name]) AND
((Attendance.Date) Between [forms]![name]![text17] And
[forms]![name]![text11]))
ORDER BY Attendance.Date;

I am trying to create a repor that will sum the hours used by repname for
specific codes. I continually receive the #ERROR. my expression is as follows
for the report:

=Dsum("[Hours]","[points query]","[Code]='Planned' or 'planned time
unplanned' or 'PTU consecutive' or 'PTU less than full shift' or 'ptu less
than half shift'")
[/QUOTE][/QUOTE]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top