Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2013
    Location
    NYC
    Posts
    7

    How can I programmatically access 'Scale' property of a decimal data type field?


    Although I can find every other property of a field, I can find no programmatical way to get a decimal field's 'scale' property. I can find 'Precision' easy enough (despite the misnomer property name 'CollatingOrder'), and while "myField.Properties("DecimalPlaces")" gets the decimal places property value (with 255 = 'Auto'), the decimal places property is ignored for decimal values (it's only applied for 'Currency,' 'Fixed,' 'Standard,' 'Percent,' and 'Scientific,' but NOT Decimal! grrrr! ), and instead uses the 'Scale' property value. But despite cycling through each property of the field using "For Each myProperty in myField.Properties" there appears to be no property to extract a decimal field's 'Scale.' I need this capability in order to accurately document the database. Anyone know how (IF) this can be done, or did Microsoft just forget to include exposing it? [Note: This is an Access 2003 database]

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I have never used Decimal, which is a FieldSize parameter of Number datatype. I set Number types to Double if I want to allow decimal. What advantage do you expect for use of Decimal?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    June7, Decimal doesn't suffer from the same rounding errors that Double and Single do.

    As for accessing the Scale, I'm not aware of any was to access that property. I'm no expert at ADO though, so there may be a way using that (there's not using DAO and ADOX though, I checked).

  4. #4
    Join Date
    Jan 2013
    Location
    NYC
    Posts
    7
    Thanks for the replies. I've been tasked with documenting a host of old, huge (and poorly written) legacy Access systems, so the choice to use Decimal was not mine. From another site, it has been suggested that I try using ADO to get to the Scale property. I'll try that once they approve me for Admin rights on this machine so I can reference the Microsoft ActiveX Data Objects 2.x Library. Thanks again.

  5. #5
    Join Date
    Jan 2013
    Location
    NYC
    Posts
    7
    OK, so to resolve the problem of access the Scale, I switched from DAO to ADO, which allows you to access Scale with code such as [myRS.Fields(FieldCnt).NumericScale]. However, this introduces its own limitations, as it appears that you cannot access the DESCRIPTION property of a field in ADO (but you can in DAO). Microsoft can be so infuriating!

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Guess you will have to use both ADO and DAO to get the output you want.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 7
    Last Post: 02-25-2012, 07:32 PM
  2. Pulling data from a scale
    By nkuebelbeck in forum Programming
    Replies: 9
    Last Post: 01-17-2012, 03:25 PM
  3. Replies: 5
    Last Post: 01-09-2012, 05:55 PM
  4. convert property TYPE to ENUM
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-10-2010, 11:09 AM
  5. Replies: 1
    Last Post: 05-17-2010, 12:21 PM

Tags for this Thread

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