Sum in Footer of Subform

I have a subform with a calculated field that refers to a field in the main form.  The main form has a field AssignDate, which is the date the exhibitor was last assigned a booth.  The subform contains the individual booth assignments and has a field AssgDate, which is the date that particular booth assignment or booth removal was done.  The subform record also included flags to indicate if the assignment is a supersede or the request is to remove a booth from the order.  The control source calculated field, txtSup is IIf(([Remove]=True Or [Supersede]=True) And [AssgDate]>[Forms]![frmOrderForAssignment]![AssignDate],1,0).  That field works.   However, when I create a field in the subform footer with the control source as Sum([txtSup]), it errors out and causes my other summary fields in that form to error out as well.  If I change it to Sum(IIf(([Remove]=True Or [Supersede]=True) And [AssgDate]>[Forms]![frmOrderForAssignment]![AssignDate],1,0)), it doesn't work either.

I have a field on the main form to capture the contents of the sum field so when the user is done making changes to the booths in the order, it can check to see if that number is 0 or not.  If it is not 0, then the Finish button will update the order with a supersede note and a supersede code.  However, that will only work if I can get the original sum field to work.  What am I doing wrong?

Hi ABaggott,

 

Thanks for posting in the community, according to your description, I did some tests trying to reproduce your situation, but I’m sorry it is little hard for me, would you mind sharing some screenshots to help us help you more efficiently?

 

Or you can share a simple test file with us via private message, we are always willing to offer help, and we also welcome any community members to share new ideas about your problems if one has related experiences.

 

Best Regards,

Arck

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I'm not sure how I can send a simplified file.  The form and subforms are driven by views and tables in SQL Server.  Here are a couple of screenshots, though.  This is what the form looks like when I don't have the field summing txtSuper:  The fields in the footer of the Booths Assigned subform are sums of fields that are calculated in the view, since they only rely on data in the record itself, and a concatenation function I built to concatenate all the active booths assigned in order to compare them to the booths actually in the order when all the assignments are complete.  They are used to alert the user of discrepancies between what the sales rep has assigned and the space or booths that are actually being invoiced to the exhibitor.

As you can see, there's no error occurring in txtSub, so I know the expression used as the control source is valid.  However, when I try to sum it, using either the name of the control or the expression that works in the control, this is what I get.

I can't calculate txtSum in the view because it refers to a value in the main form.  The idea is that if there is a supersede in the most recent assignment (some of our exhibitors will change or add space multiple times over the course of the year), it will update the supersede code and supersede note in the order itself.  Any ideas?

Amy E. Baggott

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi ABaggott,

 

Thanks for your time and patience, personally, it's too hard for me, but I’m still willing to try my best to figure out the cause, it may take some time to work on it.

 

I'm sorry I can't point out the cause of the problem quickly, I’ll keep you informed if there is any progress on my side, we also welcome any community members to share any ideas about this problem if one has related experience, your understanding will be highly appreciated!

 

Best Regards,

Arck

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Actually, I ended up working around it by creating a field in my main form that used a DCount of records where either Remove or Supersede is true and the assignment date is greater than the invoice date.  If the invoice date is null (because we haven't invoiced them yet), that field is set to 0.  It seems to be working, but I'd still like to know (if anyone can figure it out) why my original idea didn't work.

Amy E. Baggott

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Amy,

Can we assume you have "=" as the first character in the control source?

You can't sum a control, only expressions based on fields and values.

IIf() returns a string variant so we often need to wrap it in Val(IIf()).

Duane Hookom
Minnesota

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Yes, I had "=" as the first character in my control source, and the sum field in the subform footer still gave me an error.

Amy E. Baggott

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I wouldn't waste too much time if you found something that works. The other option might have been to add the AssignDate field into the record source of the subform.
Duane Hookom
Minnesota

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 223 Applies to: