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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting fields over many records to alert a user

Status
Not open for further replies.

timnicholls

Technical User
Oct 31, 2003
43
0
0
AU
Hi All,

I am working on a database for those with a disability who are still in their homes.

I have a form containing a combobox with many selections for the way a client gets in touch in a callout situation to their home. So eg: this callout was because of "Phone Call", or "Safety Button". One of those would be selected from the combobox so we can identify how the contact was made.

How do I keep a running total of the number of, for example "Phone Call"s, so that when we go to enter the same client for another callout situation and we select "Phone Call" from the dropdown box a label will appear on the form saying "Note: This is the third time this type of contact has been made"?

Then for a fourth time selecting the same callout type, for the same client, another label on the form would say "Please send a letter to this client"?

It appears to be difficult.

I can easily select only those clients in a query with "Phone Call", in the particular field. So that gives me all of them...but how does it work so that I can only select those with three then four instances of that type?

I am a little lost!

Thanks for your help.

Tim
 
Tim,

Look at DCOUNT("MyField","MyTable", sCRIT)

where sCRIT is a string like this "[PID] = " & me.[PDI]

You could loop thru these and look for more than 3.


rollie@bwsys.net
 
Thanks Rollie.

My 'DCount' solution is having some problems but I think this is the way forward!

Further work to be done by me :)

Tim
 
Tim,

If you have more than one 'count' in the same recordset, you may speed up the process by doing the looping that DCOUNT does yourself. You could do all the sums, read more than one, with a single loop. If you need code for this ask.

rollie@bwsys.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top