counting records

  • Thread starter Thread starter Khalil Handal
  • Start date Start date
K

Khalil Handal

Thanks a lot, Tina

Khalil



tina said:
hi Khalil.
James was right - i left a closing parens off of the expression. try

=Sum(IIf([CountryRegion] = "Jordanian", 1, 0))

if that doesn't work, then verify that you have a field named
CountryRegion
in the form's RecordSource, and verify that the field's data type is Text.

hth


Khalil said:
Hi again
sorry to bother you Tina,
I ommitted the = sign at the begining and had no error but when I look at
the form I see: #Name?
can you still help.
Khalil
 
Hi,
table name: tblEmployees
Query : qryNationality
Form: frmNationaliy

the query has two fields EmployeeID and CountryRegion fields.

When I open the form frmNationality have a text Box Text4 in whcih I want
to appear the number of record that have the nationality equal to
"Jordanian"
What VB Code I need?
Where is it going t be put? On the on open of the form or another place!

Khalil
 
well, assuming that frmNationality is bound to qryNationality, you can put
an unbound textbox control in frmNationality's Footer section. in the
control's ControlSource property, enter the following, as

=Sum(IIf([CountryRegion] = "Jordanian", 1, 0)

hth
 
Khalil said:
Hi Tina,
I tried but had the error:

expression containes invalid syntax
You ommited an oprand or operator, you entered an invalid character or
comma, or text without surrounding with cotation marks.

=Sum(IIf([CountryRegion] = "Jordanian", 1, 0)

I ommited the bracket ( after IIf :
=Sum(IIf[CountryRegion] = "Jordanian", 1, 0)

nad had an error asking that i must have brcakets for the IIf so added
another bracket at the end of statement but with no benefit.

Khalil
Looks like you missed a bracket at the end, try:

=Sum(IIf([CountryRegion] = "Jordanian", 1, 0))
[notice the double bracket to close]--------^

- James


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0531-3, 04/08/2005
Tested on: 05/08/2005 12:15:10
avast! - copyright (c) 1988-2005 ALWIL Software.
http://www.avast.com
 
Hi Tina,
I tried but had the error:

expression containes invalid syntax
You ommited an oprand or operator, you entered an invalid character or
comma, or text without surrounding with cotation marks.

=Sum(IIf([CountryRegion] = "Jordanian", 1, 0)

I ommited the bracket ( after IIf :
=Sum(IIf[CountryRegion] = "Jordanian", 1, 0)

nad had an error asking that i must have brcakets for the IIf so added
another bracket at the end of statement but with no benefit.

Khalil
 
Hi again
sorry to bother you Tina,
I ommitted the = sign at the begining and had no error but when I look at
the form I see: #Name?
can you still help.
Khalil
 
hi Khalil.
James was right - i left a closing parens off of the expression. try

=Sum(IIf([CountryRegion] = "Jordanian", 1, 0))

if that doesn't work, then verify that you have a field named CountryRegion
in the form's RecordSource, and verify that the field's data type is Text.

hth
 
you're welcome


Khalil Handal said:
Thanks a lot, Tina

Khalil



tina said:
hi Khalil.
James was right - i left a closing parens off of the expression. try

=Sum(IIf([CountryRegion] = "Jordanian", 1, 0))

if that doesn't work, then verify that you have a field named
CountryRegion
in the form's RecordSource, and verify that the field's data type is Text.

hth


Khalil said:
Hi again
sorry to bother you Tina,
I ommitted the = sign at the begining and had no error but when I look at
the form I see: #Name?
can you still help.
Khalil
 
after seeing your separate post re this question, i reviewed this entire
thread. i noticed your remarks following:
I ommitted the = sign at the begining and had no error but when I look at
the form I see: #Name?

are you still leaving off the equal (=) sign? if so, DON'T. you need to
enter the *complete* expression, as i gave it to you earlier in the thread:

=Sum(IIf([CountryRegion] = "Jordanian", 1, 0))

as long as there is a field in the form's underlying table that's named
CountryRegion, the expression should work. there should be no need to use a
DCount() function.

hth


tina said:
you're welcome


Khalil Handal said:
Thanks a lot, Tina

Khalil



tina said:
hi Khalil.
James was right - i left a closing parens off of the expression. try

=Sum(IIf([CountryRegion] = "Jordanian", 1, 0))

if that doesn't work, then verify that you have a field named
CountryRegion
in the form's RecordSource, and verify that the field's data type is Text.

hth


Hi again
sorry to bother you Tina,
I ommitted the = sign at the begining and had no error but when I
look
 

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

Similar Threads

Forms ? 2
Calendar & Dates 1
Copy 2
count dates 1
count dates 4
Count Function 6
Access count a field in access report 2
Sum If function in textbox 0

Back
Top