Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2012
    Posts
    3

    Unanswered: Showing max date, min date and count of records in table

    I have a simple Db consisting of a single table (tblRoomAssignment) with four fields:
    fldAutoID
    fldDate
    fldUser
    fldRoom

    I have a form where the user creates a query to locate records of interest. I'm using Combo boxes for each form field. Everything works fine.

    Now I want to add three text boxes to the form that show:
    the minimum date in fldDate,
    the maximum date in fldDate, and
    the count of records in tblRoomAssignment.

    I do not intend for the user to modify the values in these text boxes.

    I'm pretty sure I create an unbound text box and use an expression as the default value but that's as far as I've been able to get.

    Help is appreciated!

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You can indeed use the DefaultValue property with these expression:
    - For the Max value: =DMax("fldDate";"tblRoomAssignment")
    - For the Min value: =DMin("fldDate";"tblRoomAssignment")
    - For the Count: =DCount("*";"tblRoomAssignment")
    Have a nice day!

  3. #3
    Join Date
    Dec 2012
    Posts
    3
    Thank you for the help.

    When I used a semicolon between the field and table names I received the error:
    "The expression you entered contains invalid syntax
    You omitted an operand or operator, you entered an invalid character or comma, or you entered text without surrounding it in quotation marks."

    So, I changed the semicolon to a comma and it works perfectly.

    It's so simple and yet I spent several frustrating hours trying before I consulted this forum.

    Again, thank you!

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!

    Note: The character to use in the expression (comma or semicolon) depends on how the list separator is defined in the local settings of Windows.
    Have a nice day!

  5. #5
    Join Date
    Dec 2012
    Posts
    3

    Smile

    There's so much I've yet to learn.

  6. #6
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Don't we all do?
    Have a nice day!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •