Re: Main form -subform keeping count



Babs,
Try just...
Private Sub cbotruck_AfterUpdate()
Refresh
End Sub
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"babs" <babs@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:80ECE4DE-89B5-4840-9658-7ABB0227E254@xxxxxxxxxxxxxxxx
Yes it WAS working fine without adding the code for REfresh - see above. Yes
if hit F9 worked fine. with code below
=[trkloads]-DCount("[dispatchingid]","dispatchdetailsquery","dispatchid=forms!frmdispatchloc!dispatchid")

However. realized not best to count dispatching id - some include truck
contacted and NO work field check off whick means the order is not filled .
Wanted to tie it to the dcount of the field in the subform call [contacted
work] when it is check yes.
Put in this to Handle that???


=[trkloads]-DCount("[contacted
work]","dispatchdetailsquery","dispatchid=forms!frmdispatchloc!dispatchid"
And "[contacted work]"="Yes")

don't want to include dispatchid where contacted work is null or no

The calculation that i put in above to do that is not coming out with the
right #. do you see an error in the code

AS to the REFRESH error - from previous reply

Private Sub cbotruck_AfterUpdate()
totLoadsRemaining.Refresh
End Sub

- added code to the after update event of the truck combo box - the exact
error I get is error 424: Object required. Used the Name of the calc. text
box - not sure what need to add here.



"Al Camp" wrote:

Babs,
You have to provide meaningful information...
I am getting an error
What is the error?

You said you were going to stick with the Data*** subform, so I suggested that
you
drop the subform totaling and go with an aggregate function on the main form... a
calculated field with something like this.... (use your own object names)

= TotalOrders - DCount("[DispatchingID]", "tblYourTableName", "OrderID =
Forms!frmOvenLoc!OrderID")

Do you have that working yet? (even if you have to hit the F9 key manually to
recalc)
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



"babs" <babs@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:08347BE5-1972-4E49-9865-8EF77962EF1D@xxxxxxxxxxxxxxxx
Al,

below is the code I attached to the after update of the truck combo box. I
am getting an error. totloadsremaining is the NAME of the calcuation text
box. Not sure of the correct syntax.

Thanks,
Barb

Private Sub cbotruck_AfterUpdate()
totLoadsRemaining.Refresh
End Sub

"Al Camp" wrote:

Babs,
Since we don't know the exact names of all your controls... we can only use
example
names like YourTableName or YourFormName. You have to translate your names into the
code
template.
Since your calculation in the subform utilizes the DispatcherID, put a Refresh on
the
AfterUpdate of that field.
OR...
A Refresh on the AfterUpdate event of some field in your subform records that
will
always be entered.

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


"babs" <babs@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EA9385EC-12E5-493D-B4D1-9EA970A0E5DC@xxxxxxxxxxxxxxxx
Got it - had wrong table name. Calc. only refreshes when Press f9 would like
to to do it when move to new record on data***(subform)?? What would the
code be and where would I attach it to??

THANKS AGAIN

"Al Camp" wrote:

Babs,
Data*** view does not have a Header or Footer...
If you have your subform set to FormView, AND set to Single Form, you'll only
see
one
record at a time. All the records are really there, but you need to PageDown in
order
to
see them.

If you use a Form View subform set to "Continuous" View, you will see all your
records... and your footer.

If you must stay with a Data*** subform, then you'll have to use a DCount
aggregate
function to count the DispatchingIDs related to that specific order, and subtract
it
from
TotalOrders on your main form.
For example, if The Main form is related to the subform by some field like
OrderID..
On the main form, a calculated field with...
= TotalOrders - DCount("[DispatchingID]", "tblYourTableName", "OrderID =
Forms!frmOvenLoc!OrderID")

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"babs" <babs@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A2AC4B01-2101-4539-9748-8D70CEED9B23@xxxxxxxxxxxxxxxx
The calc isn't right- and I can see it on the subform only when I am in Form
view- really want the subform in Data*** view so can see all the ovens
assigned to that order. Any way to see it - should I put it on the main
form??? I cut and pasted the code below shows up as Name?.

=Forms!frmOVENLoc!totalorders-Count([dispatchingid]) & "Orders/s Remaining"


Just total orders is on the Main form and using the Count of product name on
the subform.

To get order remaining

Any reason why getting Name?- and where best place to put calc to see suform
in data*** view on with main form

??

thanks for your help,
barb

"Al Camp" wrote:

Is the Footer Visible property set to Yes?
Are you using Form View or Data*** view?

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"babs" <babs@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B8A44034-D0BC-47A0-BEA9-0A03DE22581C@xxxxxxxxxxxxxxxx
I think I have the formula in correctly but when I change the view of the
subform to form view the calculation does not show up- can not see the
footer
of the subform???????? Even in main/subform can't see footer of subform.
See
it in design view though????

Thanks,
Barb

"Al Camp" wrote:

Babs,
If you have a field on your Main form ([TotalOrders-Count])
and the Count of ProductName in the subform must be subtracted from that...
then your unbound text control in your subform Footer should be...
(use your own control names...)

= [Forms]![frmYourMainFormName]![TotalOrders-Count] - Count(Product_Name) &
"
Order/s
Remaining"

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


"babs" <babs@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8480A71F-6D01-4CA1-A923-124D635AEE77@xxxxxxxxxxxxxxxx
Thanks for your help. I added the code to an unbound control in the
footer
of my subform. However when I go to look at the mainform with subform -
don't see the field(unbound text box)??? See code put on unbound control
( 5
was just an example)
=(tblOvensLoc!totalOrders-Count([product_name])) & "Orders Remaining"

Can you see why I can't see it on the subform in Main view?

Thanks

"Al Camp" wrote:

Babs,
In the footer of your subform, an unbound calculated field with a
ControlSource
of...
= (5 - Count(SomeBoundFieldintheSub)) & "Item/s to Fill"
Each time a sub record is added, do a Refresh to update the
calculation.

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


"babs" <babs@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BA6D4A74-EEAB-49A7-9736-D431AE72F8A3@xxxxxxxxxxxxxxxx
Say -I have a total number of items listed on the main form for
example
of
5.

In the subform if I have 5 detailed records. I would like a field in
the
details table to say 0 items left to fill. If I only have 4 detailed
records obviously would like it to say 1 item to fill and so on. How
can
I
do the calc. between main and subform????

Thanks




















.


Loading