Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Sep 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Right Function (2000 SR1)

    I'm trying to display the last 4 digits of a text field in a report. I've tried using the "right" function as listed in the help files, to no avail. The field is actually a series of numbers, with leading zeros (linked to a propriety Access DB), & I want to loose the zeros.
    TIA

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Right Function (2000 SR1)

    If all you want to do is get rid of the zeros just convert the value to a number using the Val() function. If Right() isn't working, you'll need to post the code you're trying to use.
    Charlotte

  3. #3
    New Lounger
    Join Date
    Sep 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Right Function (2000 SR1)

    I'm not au fait at all with VBA so I was putting the "function" into the report text box like this;
    =right([Qry-FLT-by-driver]![HI_IDENT],4)
    The HI_IDENT being the troublesome field.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Right Function (2000 SR1)

    The <font face="Georgia">[Qry-FLT-by-driver]!</font face=georgia> part is incorrect. If your report has Qry-FLT-by-driver as Record Source, you should be able to use
    <font face="Georgia">=Right([HI_IDENT],4)</font face=georgia>
    If Qry-FLT-by-driver is a form (confusing name in that case), you should use
    <font face="Georgia">=Right([Forms]![Qry-FLT-by-driver]![[HI_IDENT],4)</font face=georgia>
    Just to be sure: in both cases, these go into the Control Source property of the text box.

  5. #5
    New Lounger
    Join Date
    Sep 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Right Function (2000 SR1)

    Well that almost works, I don't now get a parameter box, but the report shows "#Error" for that field. BTW the record source is a query.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Right Function (2000 SR1)

    Make sure that you have no typos - the name of the field must be exactly the same as in the record source.

    One other thing to check for, is missing references. Open any module (if you don't have one, just activate the Visual Basic Editor). Select Tools/References... If any reference in the list starts with MISSING, uncheck it. Then click OK. Switch back to Access and try opening the report.

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Right Function (2000 SR1)

    Make sure the name of the field in your report is not HI_IDENT - you can't have the name of a field be in the control source expression for that same field.

  8. #8
    4 Star Lounger
    Join Date
    May 2001
    Location
    Oxfordshire
    Posts
    456
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Right Function (2000 SR1)

    Ah that got it. The text box name was holding me back. Thank you everybody (the previous posts were from work).

Posting Permissions

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