Results 1 to 5 of 5
  1. #1
    cec is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Apr 2012
    Posts
    42

    Max Function Not Working With Date

    Good morning All-



    Ok I have a text box on my main form that I'm trying to pull in the most recent date from a subform.

    I have tried just : =Max(Form!Subform!RecvdDate) =Error

    I have also tried : =DMax("[RecvdDate]","tbl_Subform") = 11/7/12, which isn't the correct anwser and honestly not sure where it got that

    Can anyone help with this... Please

    Thanks!

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Look at this video on subforms for the getting the correct syntax re: subforms.

    http://www.datapigtechnologies.com/f.../subform2.html

    Alan

  3. #3
    cec is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Apr 2012
    Posts
    42
    wasn't able to open this....

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Does your IT department have restrictions on sites you can open. It is a hyperlink that should open for you. I just tested and it opened for me directly by double clicking on the link. If that doesn't work, click on the link in my signature listed for DataPig. Scroll to the section on sub-forms.

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by cec View Post

    ...Ok I have a text box on my main form that I'm trying to pull in the most recent date from a subform.

    ...I have tried just : =Max(Form!Subform!RecvdDate) =Error

    ...I have also tried : =DMax("[RecvdDate]","tbl_Subform") = 11/7/12, which isn't the correct
    Aggregate Functions, such as Max or DMax, cannot be run against the Controls in a Form, as you first attempted! They have to be run against a Field in a Table or Query, such as in your second example.

    Quote Originally Posted by alansidman View Post
    Look at this video on subforms for the getting the correct syntax re: subforms.
    Since you cannot run Aggregate Functions against the Controls in a Form (or Subform) the proper syntax for referencing these Controls, in a Subform, isn't really germane to the question at hand.

    Assuming that RecvdDate and tbl_Subform are spelled correctly, the first thing I'd look at would be the Datatype of RecvdDate. Is it actually defined as a DateTime Field? Defining a date-holding Field as Text is a frequent causative factor when 'dates' misbehave!

    Another thing that causes problems with dates is when the date format being used is not the U.S. format, i.e. is not MM/DD/YYYY. MS Access is very US-centric in this matter. If you're using a British-type formatting, have look at Allen Browne's excellent article on handling international dates.

    http://allenbrowne.com/ser-36.html

    Linq ;0)>

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

Similar Threads

  1. Nz function not working
    By Beerman in forum Queries
    Replies: 4
    Last Post: 10-24-2012, 11:46 AM
  2. Sort function not working correctly
    By kristyspdx in forum Reports
    Replies: 2
    Last Post: 10-09-2012, 11:04 AM
  3. Replies: 3
    Last Post: 09-19-2012, 08:59 AM
  4. NZ() function not working?
    By EvanRosenlieb in forum Programming
    Replies: 6
    Last Post: 12-22-2011, 05:37 PM
  5. working as a vlookup function
    By cleon in forum Queries
    Replies: 3
    Last Post: 12-16-2011, 02:51 PM

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