Using a where clause on a subform??

k0r54

Registered User.
Local time
Today, 10:43
Joined
Sep 26, 2005
Messages
94
Hi,

I have a sub form on my form which displays the normalised data on a datasheet.

I have managed to create a txt box on my main form that contains the number of records within that subform by doing this in the control source.
Code:
ControlSource --> =subform_controlname.form.recordset.recordcount

How do i know create another text box that display the number of rows within the subform where fielda = "String" (string being a word)????

Thanks
k0r54
 
Try using the Dcount function.

In the control source of your textbox, type in:

= Dcount("[fieldname]","recordsource","criteria")

Fieldname is self-explanatory.

Recordsource is the recordsource of your subform.

Criteria is the condition.

After the comma, insert something like this:

"[fieldname]= '" & string & "'"

Try it and let me know if you are successful.
 
Hi,

I have put this in the control source
Code:
=DCount("Device","Monthly_below_report_calls.Form!","Device = DISP")

The field is device, and the criteria is DISP

i get #ERROR in the txt box instead.

When i am just look to get the value i use this: -
Code:
=Monthly_below_report_calls.Form![Call ID]

and it works

Thanks for your help edtab
k0r54
 
This doesn't work either
Code:
=DCount("Forms![Monthly Report]![Monthly_below_report_calls]![Device].Form","Forms![Monthly Report]![Monthly_below_report_calls].Form","Forms![Monthly Report]![Monthly_below_report_calls].Form![Device]='DISP'")
 

Users who are viewing this thread

Back
Top Bottom