query a form

sadie

Registered User.
Local time
Today, 11:46
Joined
Apr 11, 2003
Messages
115
I have a subform where I input data about a client
Is there a way to query or filter it for example every time a client goes awol I enter it in the subform,..I know I can filter the word awol but how can I coun t the number of awols for one specific client or all the clients
 
You could create a query the groups by the client and have it count the field where awol would be.
 
query

thanks, but how do I query a subform
 
Well there's several approaches you can take.

One, you can base the subform on a query.

Two, you could create a command button that runs a procedure that will count how many awol's for whatever client is selected in the subform and display it in a messagebox or textbox.

Do either of those sound like what you want?
 
query a subform

I'd like to use the command button if you could help me with that
 
Well I would first put the button on the main form.

Then create a procedure in it's on click event like this:

Assuming you have a number id for the records in the subform:
Dim intID as Integer
Dim intCount as Integer

intID=Me!SubformName.Form!NameofIDField

intcount=DCount("[ID Field]","[Name of table]","[ID Field]=" & intid & " And [Field where awol is]='awol'")

msgbox "Number of awols for this client: " & intcount



Try this out.
 

Users who are viewing this thread

Back
Top Bottom