Thinking that something must be getting lost in translation, here is a complete rundown on my subform:
The Subform [tblActivity Subform] has the following record source:
SELECT [tblActivity].[ActivityPK], [tblActivity].[ActivityID], [tblActivity].[ActivityDate], [tblActivity].[ActivityTypeID], [tblStatusTypes].[Type], [tblActivity].[ActivityChapter], [tblActivity].[ActivityState] FROM tblStatusTypes INNER JOIN tblActivity ON [tblStatusTypes].[MemberTypeID]=[tblActivity].[ActivityTypeID] ORDER BY [tblActivity].[ActivityID], [tblActivity].[ActivityDate], [tblActivity].[ActivityTypeID];
In the Details section, this gives me the fields of, [ActivityID] [ActivityDate] [ActivityTypeID] [Activity Chapter] and [Activity State]. I have chosen not to show [ActivityPK] on the subform.
I then have a hidden textbox [txtPrev] which uses Rich's "PrevRecVal" module. It has the following control source:
=PrevRecVal([Form],"ActivityPK",[ActivityPK],"ActivityDate")
I then have a calculated textbox [DaysOut] that has the following as it's control source:
=IIf(IsDate([txtPrev]),(IIf([ActivityTypeID]=9 Or [ActivityTypeID]=10 Or [ActivityTypeID]=11 Or [ActivityTypeID]=14 Or [ActivityTypeID]=17 Or [ActivityTypeID]=18,DateDiff("d",[txtPrev],[ActivityDate]),0)),0)
This works perfectly to bring me the days difference between records, if the ActivityTypeID's are in the previous record.
This is the point where Pat recommended that I put a textbox [DaysSum] in the subform footer and use SUM function. Pat stated that I could not reference the control [DaysOut] directly (since it's calculated) and that I would have to use SUM and the calculation that [DaysOut] used. I therefore used the following as the control source for [DaysSum]:
=Sum(IIf(IsDate([txtPrev]),(IIf([ActivityTypeID]=9 Or [ActivityTypeID]=10 Or [ActivityTypeID]=11 Or [ActivityTypeID]=14 Or [ActivityTypeID]=17 Or [ActivityTypeID]=18,DateDiff("d",[txtPrev],[ActivityDate]),0)),0))
This is were I get an #error, in the [DaysSum] field.
I hope this helps anyone trying to help figure this out.
Bluez