Help with Function to redisplay a cost price...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil.Latio

    Help with Function to redisplay a cost price...

    I'm trying to write a function to achieve the following;

    Some bright spark thought it would be a good idea to have a report
    that has the cost price masked with the first 10 letters of the
    alphabet - sometimes these reports are used in front of our customers
    and our guy needs to know the cost-price without the customer being
    aware of it.

    So 200 would read AJJ, 350 would read CEJ etc

    I'm trying to put together a function to convert the numerical
    characters into component parts, but I am stuck at how to start.

    I'm thinking I'd need a SELECT Case statement to determine the letters
    of the alphabet that will substitute the numerical characters, but how
    to go through the numerical character is a bit of an obstacle! I've
    sat with a blank screen for a good half hour now :-(

    If anyone has any pointers, I'd be grateful

    Many thanks to anyone who can assist,

    Cheers,

    Phil
  • Damon Heron

    #2
    Re: Help with Function to redisplay a cost price...

    Just off the top of my head, I would convert your cost price to a string
    using CSTR(350), get length with LEN, then cycle thru the string LEN times
    adding 65 to each and concatenating CHR(x) as the resulting letter.
    In the immediate window, I can ?LEFT(CSTR(523) ,1)+65 which gives me 70 (for
    the 5) and ?chr(70) gives me an F.
    so, try a for next loop... We are assuming this is all whole numbers,
    right? No $123.45.. cause then we would have to attack the decimal or
    convert to integer.

    This should get you started....
    Damon

    "Phil.Latio " <phil.latio@lyc os.co.uk> wrote in message
    news:286fe76.04 02111411.1c2b30 a9@posting.goog le.com...[color=blue]
    > I'm trying to write a function to achieve the following;
    >
    > Some bright spark thought it would be a good idea to have a report
    > that has the cost price masked with the first 10 letters of the
    > alphabet - sometimes these reports are used in front of our customers
    > and our guy needs to know the cost-price without the customer being
    > aware of it.
    >
    > So 200 would read AJJ, 350 would read CEJ etc
    >
    > I'm trying to put together a function to convert the numerical
    > characters into component parts, but I am stuck at how to start.
    >
    > I'm thinking I'd need a SELECT Case statement to determine the letters
    > of the alphabet that will substitute the numerical characters, but how
    > to go through the numerical character is a bit of an obstacle! I've
    > sat with a blank screen for a good half hour now :-(
    >
    > If anyone has any pointers, I'd be grateful
    >
    > Many thanks to anyone who can assist,
    >
    > Cheers,
    >
    > Phil[/color]


    Comment

    • Phil.Latio

      #3
      Re: Help with Function to redisplay a cost price...

      Hi Damon,

      Sorry for the delay in responding to your helpful suggestion!
      I got it to work a treat - even though they wanted to alias the
      numerical characters with those from a meaningful phrase as opposed
      straight abc... etc!

      Many thanks, for the pointers and not giving a single bit of code,
      just the thought process - thanks again.

      Cheers,

      Phil


      "Damon Heron" <damon327@hotma il.com> wrote in message news:<D66dnaoxO c6pJrfd4p2dnA@c omcast.com>...[color=blue]
      > Just off the top of my head, I would convert your cost price to a string
      > using CSTR(350), get length with LEN, then cycle thru the string LEN times
      > adding 65 to each and concatenating CHR(x) as the resulting letter.
      > In the immediate window, I can ?LEFT(CSTR(523) ,1)+65 which gives me 70 (for
      > the 5) and ?chr(70) gives me an F.
      > so, try a for next loop... We are assuming this is all whole numbers,
      > right? No $123.45.. cause then we would have to attack the decimal or
      > convert to integer.
      >
      > This should get you started....
      > Damon
      >
      > "Phil.Latio " <phil.latio@lyc os.co.uk> wrote in message
      > news:286fe76.04 02111411.1c2b30 a9@posting.goog le.com...[color=green]
      > > I'm trying to write a function to achieve the following;
      > >
      > > Some bright spark thought it would be a good idea to have a report
      > > that has the cost price masked with the first 10 letters of the
      > > alphabet - sometimes these reports are used in front of our customers
      > > and our guy needs to know the cost-price without the customer being
      > > aware of it.
      > >
      > > So 200 would read AJJ, 350 would read CEJ etc
      > >
      > > I'm trying to put together a function to convert the numerical
      > > characters into component parts, but I am stuck at how to start.
      > >
      > > I'm thinking I'd need a SELECT Case statement to determine the letters
      > > of the alphabet that will substitute the numerical characters, but how
      > > to go through the numerical character is a bit of an obstacle! I've
      > > sat with a blank screen for a good half hour now :-(
      > >
      > > If anyone has any pointers, I'd be grateful
      > >
      > > Many thanks to anyone who can assist,
      > >
      > > Cheers,
      > >
      > > Phil[/color][/color]

      Comment

      Working...