Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

When all records in a subform combo box are a certain value, flag.

0 views
Skip to first unread message

mattieflo

unread,
Nov 19, 2007, 7:09:06 PM11/19/07
to
Hello,

I have a form named EMAIL and on it is a subform named PURCHASE ORDERS. Each
EMAIL has several PURCHASE ORDERS. On the PURCHASE ORDER subform, there is a
drop down box that indicates Pending or Completed. I want to program this so
that when all PURCHASE ORDERS are set to "Completed" that it will flag a
checkbox on the EMAIL main form. Does anyone have any suggestions on how to
go about this? Thanks!

Stuart McCall

unread,
Nov 19, 2007, 7:30:36 PM11/19/07
to
"mattieflo" <matt...@discussions.microsoft.com> wrote in message
news:9E27FF53-D475-4758...@microsoft.com...

Use code like this in your main form's Current event:

Dim CompletedCount As Long
Dim SubformCount As Long

CompletedCount = Dcount("*","PURCHASE ORDERS","ComboField = 'Completed'")
SubformCount = Me.SubformControlName.Form.Recordcount
Me.CheckboxName.Value = (CompletedCount = SubformCount)

(alter the control names accordingly, of course)


mattieflo

unread,
Nov 20, 2007, 11:25:02 AM11/20/07
to
Hi Stuart,

I just realized that EMAIL is also a subform. They are linked together and
EMAIL is the parent form and PURCHASE ORDERS is the child form. I still want
it to do the same thing, but I'm not writing the code right that you
provided. Could you help me with how to reference that subform? Thanks.

Stuart McCall

unread,
Nov 20, 2007, 1:04:51 PM11/20/07
to
"mattieflo" <matt...@discussions.microsoft.com> wrote in message
news:E3133C56-7802-4B05...@microsoft.com...

Ok, if I understand you correctly, getting the SubformCount ought to go
something like this:

SubformCount =
Me.EMAILSubformControlName.Form.PURCHASEORDERSSubformControlName.Form.Recordcount

(that's one line of code)

mattieflo

unread,
Nov 20, 2007, 2:54:00 PM11/20/07
to
Great thanks Stuart.
0 new messages