Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jul 2003
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Append Query feild lenths (Access97 SR1)

    Hi I am trying to create an append query over some data which I have imported from a .csv file the field contains gallons used as text I have used "Gallons: Left([Numberof gallons],1) & "." & Right([Numberof gallons],2)" to put a point in 2 digits from the right. My problem comes if the user uses over 10 gallons as only one digit shown. If I show 2 digits then when the amount is less than 10 I get the first number after the . How can I get this to work out whether I need 1 or 2 digits?

    Thanks for any help given

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

    Re: Append Query feild lenths (Access97 SR1)

    Hi Mick,

    Welcome to the Lounge. Does this work for the integer part?

    Left([NumberOf Gallons], Len([NumberOf Gallons])-2)

    Or why don't you use Val([NumberOf Gallons])/100 ? That will convert it to a number with two decimal places.

    If this doesn't help, please give some examples of what the data in the csv file look like

  3. #3
    New Lounger
    Join Date
    Jul 2003
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks very much

    Val([NumberOf Gallons])/100 worked fine and I will be changing some of the other parts I have done the other way.
    I did not think I could do this as I had already tried it without the VAL which was what I was Missing
    Thanks again.
    Mick.

Posting Permissions

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