Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    9

    Unanswered: Number field returns -3 rather than -003

    I have a number field with values such as -003 (the format property of the field is set to -000 etc) - but when I retrieve this field via an ADO recordset I get -3. How can I rectify this so I get -003 back?

    TIA

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Through a user defined function pass to it how many digits should the number has:

    Something like this

    function digits(anyString)
    If anyString < 10 Then
    backVal = "0" & anyString
    Else
    backVal = anyString
    End If
    digits= backVal
    end function
    Ok?

  3. #3
    Join Date
    Oct 2003
    Posts
    9
    Thanks - I will have a go, so convert the number to a string and then process and then convert it back using val?

  4. #4
    Join Date
    Oct 2003
    Posts
    706

    Re: Number field returns -3 rather than -003

    Originally posted by flutedoodler
    I have a number field with values such as -003 (the format property of the field is set to -000 etc) - but when I retrieve this field via an ADO recordset I get -3. How can I rectify this so I get -003 back?
    TIA
    The data is stored as binary; not in any particular format. When you retrieve the data with ADO, you get the number. "Format it as you wish." What you should do, in VB or whatever, is to format the value you received prior to displaying it. Exactly as MS-Access did when responding to your "format" property setting.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

  5. #5
    Join Date
    Oct 2003
    Posts
    9
    Thanks - I used the format function and it works perfectly...

Posting Permissions

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