Results 1 to 6 of 6
  1. #1
    gbritton is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    3

    How to use an expression in a report

    I have a report that includes a text field containing a date (in text though, not a date type). The date is like '2016-03-24 09:47:00'. The report runs and shows the date properly. Now however, I only want the date portion so I tried to modify that report field by adding an expression:



    Left$(myfieldname, 10)

    However, now, when I run the report, it shows #Type! where the date used to be.

    What am I doing wrong?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You would need an = at the beginning for one thing.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    gbritton is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    3
    Quote Originally Posted by pbaldy View Post
    You would need an = at the beginning for one thing.
    yes, of course. That is actually what I have coded. (WHen I didn't, I got a different error message). So the actual contents of the expression (copy/paste) are:

    Code:
    =Left$([L1-Last Updated Date],10)
    Yet, I still get that funny error.

    Any ideas why?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    And there are values in the field, it's not blank?

    Try

    =Left([L1-Last Updated Date],10)

    Oh, and make sure the textbox doesn't have the same name, which can throw access off.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    gbritton is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    3
    So I renamed the field on the report to avoid the name collision and replaced the expression with your variant.

    It worked!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Yours may have worked too. I forgot about the name thing at first.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Need help with a report expression
    By Rustyone in forum Reports
    Replies: 4
    Last Post: 01-31-2014, 09:57 PM
  2. Replies: 2
    Last Post: 05-10-2013, 03:37 PM
  3. Using an Iif expression in a report
    By jsfasman in forum Reports
    Replies: 2
    Last Post: 04-28-2013, 11:58 AM
  4. Expression on Report #Name?
    By burrina in forum Reports
    Replies: 0
    Last Post: 01-06-2013, 02:42 AM
  5. Report - Expression Builder
    By AndreasPanayiotou in forum Reports
    Replies: 3
    Last Post: 09-16-2012, 01:10 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