Results 1 to 4 of 4
  1. #1
    afa is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2016
    Posts
    22

    Form and Subform Calculations

    I have a main form titled

    "ForCalculationEntry" with the [Item] field and a [Receive Date] field.
    This is an entry form.

    I also have a subform titled "PO1 subform2" with the field [Promised Date].
    This form reports the promised date associated to the Item entered in the "ForCalculationEntry" from.

    I am attempting to take the difference of both dates and let me know if it is late or on time.

    I attempted the following:
    =IIf(Abs(DateDiff("d",[Promised Date],[Receive Date]))>5,"Part is late, Click Below to Notify Buyer","Part Arrived On Time")

    I get this error message: #Name?

    I also attempted the following:


    =IIf(Abs(DateDiff("d",[Forms]![PO1 subform2]![OriginalPromisedDate],[Forms![ForCalculationEntry]![Receive Date]))>5,"Part is late, Click Below to Notify Buyer","Part Arrived On Time")

    with the same error message.

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I think the problem is how you are referring to the subform control.

    To refer to a control on a subform, the syntax is:
    Code:
    Me!Subform1.Form!ControlName
    So try:
    Code:
    [Forms]![ForCalculationEntry]![PO1 subform2].Form![OriginalPromisedDate]

    I would try getting the Datediff() function working first, then add the IIF() function.


    See:
    Refer to Form and Subform properties and controls
    http://access.mvps.org/access/forms/frm0031.htm

  3. #3
    afa is offline Novice
    Windows 8 Access 2013
    Join Date
    Feb 2016
    Posts
    22
    Yup!

    That did the trick! Thanks!

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Happy to help....

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 30
    Last Post: 09-30-2015, 10:58 AM
  2. Replies: 8
    Last Post: 03-13-2013, 08:32 AM
  3. Form/Subform Calculations
    By sidewayzalex in forum Forms
    Replies: 0
    Last Post: 08-15-2011, 01:11 PM
  4. subform calculations
    By genesis in forum Forms
    Replies: 0
    Last Post: 12-03-2009, 07:18 PM
  5. Subform calculations
    By foureyes in forum Forms
    Replies: 4
    Last Post: 07-27-2009, 08:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums