want to count this statement:

  • Thread starter Thread starter ياسر
  • Start date Start date
Ù

ياسر

i have a table named employees
and it contains the following data:
employee_name - department - titles - job
i want to count how many Engineer in the department named project control
i used this but it not worked
=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer '"&
[department]=project control)
it gives me error
so what is the problem
 
i have a table named employees
and it contains the following data:
employee_name - department - titles - job
i want to count how many Engineer in the department named project control
i used this but it not worked
=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer '"&
[department]=project control)
it gives me error
so what is the problem

There is a difference between using the Ampersand (&) and the word And
in the where clause.

What is the actual value stored as [Title]? is it "Engineer " (note
the trailing space) or "Engineer" ? Each is a different value from the
other, so you must not add a space if it is not part of the actual
value. You used ='Engineer '. Most likely it should be ='Engineer'.
Also, what datatype is [department]? Is it a number datatype? Or Text?
What is project control? Is that the name of a control on the form
which displays the department number? If so, because the control name
contains a space you must enclose it in brackets.

Assuming [department] is a number datatype, then try this:

=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer' AND
[department]=" & [project control])

However, if department is in fact a Text datatype, then try:

=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer' AND
[department]= '" & [project control] & "'")

Note the unusual spelling of the field named "titels" above. If that
is the correct spelling of the field name, that is fine. However if it
is a misspelling of a field named "Titles" you need to fix it in your
code.
 
it gives me this massage
the expression you entered contains invalid syntax
you may have entered an operand without an operator

and about the statment i wrote :
the department datatype is text and the titels is Engineer

fredg said:
i have a table named employees
and it contains the following data:
employee_name - department - titles - job
i want to count how many Engineer in the department named project control
i used this but it not worked
=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer '"&
[department]=project control)
it gives me error
so what is the problem

There is a difference between using the Ampersand (&) and the word And
in the where clause.

What is the actual value stored as [Title]? is it "Engineer " (note
the trailing space) or "Engineer" ? Each is a different value from the
other, so you must not add a space if it is not part of the actual
value. You used ='Engineer '. Most likely it should be ='Engineer'.
Also, what datatype is [department]? Is it a number datatype? Or Text?
What is project control? Is that the name of a control on the form
which displays the department number? If so, because the control name
contains a space you must enclose it in brackets.

Assuming [department] is a number datatype, then try this:

=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer' AND
[department]=" & [project control])

However, if department is in fact a Text datatype, then try:

=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer' AND
[department]= '" & [project control] & "'")

Note the unusual spelling of the field named "titels" above. If that
is the correct spelling of the field name, that is fine. However if it
is a misspelling of a field named "Titles" you need to fix it in your
code.
 
ياسر said:
it gives me this massage
the expression you entered contains invalid syntax
you may have entered an operand without an operator

and about the statment i wrote :
the department name is project control
and the datatype is text and the titels is Engineer
fredg said:
i have a table named employees
and it contains the following data:
employee_name - department - titles - job
i want to count how many Engineer in the department named project control
i used this but it not worked
=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer '"&
[department]=project control)
it gives me error
so what is the problem

There is a difference between using the Ampersand (&) and the word And
in the where clause.

What is the actual value stored as [Title]? is it "Engineer " (note
the trailing space) or "Engineer" ? Each is a different value from the
other, so you must not add a space if it is not part of the actual
value. You used ='Engineer '. Most likely it should be ='Engineer'.
Also, what datatype is [department]? Is it a number datatype? Or Text?
What is project control? Is that the name of a control on the form
which displays the department number? If so, because the control name
contains a space you must enclose it in brackets.

Assuming [department] is a number datatype, then try this:

=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer' AND
[department]=" & [project control])

However, if department is in fact a Text datatype, then try:

=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer' AND
[department]= '" & [project control] & "'")

Note the unusual spelling of the field named "titels" above. If that
is the correct spelling of the field name, that is fine. However if it
is a misspelling of a field named "Titles" you need to fix it in your
code.
 
If you actually mean that the department is project control, try

=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer ' AND
[department]='project control'")
 
êÇÓÑ said:
it gives me this massage
the expression you entered contains invalid syntax
you may have entered an operand without an operator

and about the statment i wrote :
the department name is project control
and the datatype is text and the titels is Engineer
fredg said:
On Mon, 22 Dec 2008 09:19:01 -0800, êÇÓÑ wrote:

i have a table named employees
and it contains the following data:
employee_name - department - titles - job
i want to count how many Engineer in the department named project control
i used this but it not worked
=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer '"&
[department]=project control)
it gives me error
so what is the problem

There is a difference between using the Ampersand (&) and the word And
in the where clause.

What is the actual value stored as [Title]? is it "Engineer " (note
the trailing space) or "Engineer" ? Each is a different value from the
other, so you must not add a space if it is not part of the actual
value. You used ='Engineer '. Most likely it should be ='Engineer'.
Also, what datatype is [department]? Is it a number datatype? Or Text?
What is project control? Is that the name of a control on the form
which displays the department number? If so, because the control name
contains a space you must enclose it in brackets.

Assuming [department] is a number datatype, then try this:

=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer' AND
[department]=" & [project control])

However, if department is in fact a Text datatype, then try:

=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer' AND
[department]= '" & [project control] & "'")

Note the unusual spelling of the field named "titels" above. If that
is the correct spelling of the field name, that is fine. However if it
is a misspelling of a field named "Titles" you need to fix it in your
code.

So Project Name is a value, not the name of a control?

=DCount("[titels]"; "[Employees]"; "[title] = 'Engineer' AND
[department]= 'project control'"))

Actually you should use:

=DCount("*"; "[Employees]"; "[title] = 'Engineer' AND
[department]= 'project control'"))
 
thank you for replaying me i hope that i didn't disturb you with my request
then can i ask for another question please ?
if so then"
I work in company that takes 2 days for weekend it's Friday and Saturday
and all the holidays that may be more than one day such as Eid El Adha
is more than 3 days continuously.
So i made a form for entering the vacation for each employee in the company
like the following :
the main form :
Emp name , Department , and then the sub form like the following:
Date from , Period , Date to , kind of vacation
So how to calculate the vacations days for the emp without counting any of
the weekend days or holidays that's may be more than 3 or 4 days as i said
before.
like : emp takes 10 days vacation from 1/12/2008 To 10/12/2008 so there is
Friday and Saturday counted i don't want them to be counted so the condition
is that the Emp vacation is to be ended in 12/12/2008 or if there is any
other holidays in between the vacation for the Employee
every employee has an account limit for the vacation its 21 days for
whom have experience for 1 year To 10 years for the current year OR 30 days
for whom that have experience more than 10 years or more every current year
So I need to calculate the days that he toke throw the current year as i
wrote before .
is there any way to do by using the form with sub form that i made above
main form contains the information for the Employee
sub form contains the processing for the vacations details
date from - period - date to - kind of the vacation.

thank you very much
 
Back
Top