--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200601/1
=IIf([txtboxquarter]=1,(Sum(Abs([datesold] Between DateSerial(Forms!
formquarterly!txtboxyear,1,1) And DateSerial(Forms!formquarterly!txtboxyear,3,
31) And [useddept]="Retail" And [Source]="New Trade")*[saleprice])-Sum(Abs(
[datesold] Between DateSerial(Forms!formquarterly!txtboxyear,1,1) And
DateSerial(Forms!formquarterly!txtboxyear,3,31) And [useddept]="Retail" And
[Source]="New Trade")*[cost]))/[txtboxunitsNTR],IIf([txtboxquarter]=2,(Sum
(Abs([datesold] Between DateSerial(Forms!formquarterly!txtboxyear,4,1) And
DateSerial(Forms!formquarterly!txtboxyear,6,30) And [useddept]="Retail" And
[Source]="New Trade")*[saleprice])-Sum(Abs([datesold] Between DateSerial
(Forms!formquarterly!txtboxyear,4,1) And DateSerial(Forms!formquarterly!
txtboxyear,6,30) And [useddept]="Retail" And [Source]="New Trade")*[cost]))/
[txtboxunitsNTR],IIf([txtboxquarter]=3,(Sum(Abs([datesold] Between DateSerial
(Forms!formquarterly!txtboxyear,7,1) And DateSerial(Forms!formquarterly!
txtboxyear,9,30) And [useddept]="Retail" And [Source]="New Trade")*[saleprice]
)-Sum(Abs([datesold] Between DateSerial(Forms!formquarterly!txtboxyear,7,1)
And DateSerial(Forms!formquarterly!txtboxyear,9,30) And [useddept]="Retail"
And [Source]="New Trade")*[cost]))/[txtboxunitsNTR],(Sum(Abs([datesold]
Between DateSerial(Forms!formquarterly!txtboxyear,10,1) And DateSerial(Forms!
formquarterly!txtboxyear,12,31) And [useddept]="Retail" And [Source]="New
Trade")*[saleprice])-Sum(Abs([datesold] Between DateSerial(Forms!
formquarterly!txtboxyear,10,1) And DateSerial(Forms!formquarterly!txtboxyear,
12,31) And [useddept]="Retail" And [Source]="New Trade")*[cost]))/
[txtboxunitsNTR])))
there are 36 text boxes on this page, each with a formula similar to this one.
is this the problem?
Larry Linson
Microsoft Access MVP
"kaos...@comcast.net via AccessMonster.com" <u15580@uwe> wrote in message
news:5b0061d1ea7ea@uwe...
Larry Linson wrote:
>Put that code into a function and call the function as the Control Source,
>as a start. What you have is difficult to follow and difficult to maintain.
>Whether it will result in a "Too Many Fields" message, I couldn't say.
>
> Larry Linson
> Microsoft Access MVP
>
>> something else strange... i tried to separate the report out a little into
>> subforms, but just one page had the same result. my formulas are LARGE
>[quoted text clipped - 57 lines]
> ok... next question is how do i call a
> function as the control source of a
> textbox? i've still new-ish to vba.
Put the function in the Form's module. If the function name is YourFunc,
then open the Property Sheet for the TextBox and set its Control Source to
=YourFunc(). Must be a Function, a Sub procedure will not work in this
context.
--