Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting Module 2

Status
Not open for further replies.

Dre313

Technical User
Jun 4, 2003
219
US
I have a module .. that counts the first two letters in my field "INSP"

module:
Code:
Function funCount1(prmSearchString As String) As String
    funCount1 = DCount("[INSP]", "[qryQualityStatus]", "left([INSP],2) = '" & prmSearchString & "'")
End Function

I insert this code in my report as follows..

Code:
=funCount1("DR")
in a txt box ... this would count all "DR" in my "INSP" field and display the number..

Now I need the count of all data with "DR" (or the first two letters in my INSP field) AND a COUNT REJ of "Y"
REJ would be another field in my table. Both have to be met and a count of that set of records..

help please thanks..
 
If i were to do that as you suggested.. I believe I would come into some problems.. for I need two sets of numbers.. my first number would be a count of all records .. within a specified date range.. with a match of "DR" in my INSP field... if I add all REJ of "Y" into my query .. wouldnt that pull all DR with Y but in return mess up the first set of numbers that pulls all "DR"

ie..

rec1 DR12 Y
rec2 DR N

in the report.. I want numbers to appear like so..

DR... 2 1

2 being the total numbers of DR and 1 being the total number of DR and Y



thanks
 
How about

Function funCount1(prmSearchString As String) As String
funCount1 = DCount("[INSP]", "[qryQualityStatus]", "left([INSP],2) = '" & prmSearchString & "'")
funCount2 = DCount("[INSP]", "[qryQualityStatus]", "left([INSP],2) = '" & prmSearchString & "' And [REJ] = 'Y'")

End Function

Then set one box = funCount1 and the other to funCount2?

Jim DeGeorge [wavey]
 
what Am I suppose to write in the txt box of my report for the second one ??

the first one reads..

=funCount1("DR")

how would the second look?

I tried

=funCount2("y")

That doesnt seem to work.. an Enter Parameter funcount2 comes up..

what did i do wrong ?

thanks
 
Heres what I did.. I think we might have to seperate.. the function3 on its on... so I tried this..
Code:
Function funCount3(prmSearchString2 As String) As String
    funCount3 = DCount("[INSP]", "[qryQualityStatus]", "left([INSP],2) = '" & prmSearchString2 & "' And [REJ] = 'Y'")
End Function

And then in my report.. I made another txt box and entered this in it..
Code:
=funCount3("DR") And ("y")

I'm getting a -1 for an answer.. which is total wrong..
what am I doing wrong here..

thanks
 
duh..I think I got it.. just came to me..

I already have "Y" in the mod.. wat a ding dong i am hehe

thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top