Dcount

E

Evi

Which of your fields are text fields and which a number fields
(this makes a difference to the number of quote marks in your DCount)
If you wanted to count a field and the criteria field in your query was a
text field you would need
=Dcount("[MyCountField]","MyTable","[MyField]='" & [MyField] & "'")



ie after the last comma its

quote, [fieldname], equals, apostrophe, quote, &, [FieldName], &, quote,
apostrophe, quote, close bracket.



(Phew!!!)



Evi
 
E

Evi

a said:
Id Name job passportNo Serial
1 a bsc 11212 1
2 c infant 11212 1
3 djfj infant 11212 1
4 asdsfad mang 15456 2
5 asdfdsf non 4564 3
From the above Query you see serial give the 3 first row the same number 1
because they are related to each other . again if you see serial no (ID 1 )
he take serial 1 and the second and third row take no 1 also ..
What I want to tell you :
If Job infant and passportno as same as previous give the current record the
same Serial
I have this code but I couldn't complete it
Serial: IIf([JOB]="infant","",DCount("*","MyQuery","ID<=" & [MyTable].[
ID]))

Id Name job passportNo Serial
1 a bsc 11212 1
2 c infant 11212 1
3 djfj infant 11212 1
4 asdsfad mang 15456 2
5 asdfdsf non 4564 3

The code should be like this
Serial: IIf([JOB]="infant","((((Here The
Expression)))))",DCount("*","MyQuery","ID<=" & [MyTable].[ ID]))

What I want you to do:
1 - complete the code for me.
2- give me explanation to the second part of my code Dcount
Thank you in Advance


To answer the second part of your question. The Dcount says (in Normal
language)

Count everything (that's the *) in a query called MyQuery where the thing
that appears in the ID field is the same as the ID field in this record.

Usually, you won't need the [MyTable] bit. That's only necessary if the ID
field could belong to more than one table or query within your Query. I'm
assuming that you haven't called more than one Primary Key field in your
database 'ID'..have you???

If you have, smack your legs for letting Access tell you what call your
Primary Key field! It's best to choose a different one for each table
otherwise you could easily get in a real muddle trying to decide which ID
field you are looking at.


Evi
 
A

a

Id Name job passportNo Serial
1 a bsc 11212 1
2 c infant 11212 1
3 djfj infant 11212 1
4 asdsfad mang 15456 2
5 asdfdsf non 4564 3
From the above Query you see serial give the 3 first row the same number 1
because they are related to each other . again if you see serial no (ID 1 )
he take serial 1 and the second and third row take no 1 also ….
What I want to tell you :
If Job infant and passportno as same as previous give the current record the
same Serial
I have this code but I couldn’t complete it
Serial: IIf([JOB]="infant","",DCount("*","MyQuery","ID<=" & [MyTable].[
ID]))

Id Name job passportNo Serial
1 a bsc 11212 1
2 c infant 11212 1
3 djfj infant 11212 1
4 asdsfad mang 15456 2
5 asdfdsf non 4564 3

The code should be like this
Serial: IIf([JOB]="infant","((((Here The
Expression)))))",DCount("*","MyQuery","ID<=" & [MyTable].[ ID]))

What I want you to do:
1 – complete the code for me.
2- give me explanation to the second part of my code Dcount
Thank you in Advance
 

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

Access Dcount (multiple criteria) 3
DCount alwaysreturning 1 0
DCount in Subform question 1
Access MS Access DCount function problem 0
Run-time error '3045' 6
DCount 2
Dcount operation 2
DCount problem redux 4

Top