> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Return the Precision and Scale of a Decimal Field in Access
- URL: https://nolongerset.com/decimal-precision-and-scale-in-access/
- Published: 2022-02-23T02:37:09.000Z
- Updated: 2026-05-08T12:59:29.000Z
- Description: There's no way to use DAO to return the scale and precision of a Decimal field in Access. Luckily, there's an easy workaround using ADO.
- Author: Mike Wolfe
- Tags: Code Library, #SqlServer, #Import 2026-05-20 02:59

Retrieving the precision and scale of a Decimal data type field is surprisingly difficult in Access because those two attributes are not available via the [DAO Field object](https://docs.microsoft.com/en-us/office/client-developer/access/desktop-database-reference/field-object-dao). In fact, I'm not aware of any way you can use DAO to retrieve that data.

We'll use the [ADO Column object](https://docs.microsoft.com/en-us/sql/ado/reference/adox-api/column-object-adox?view=sql-server-ver15) to fetch the precision and scale settings of a Decimal field.

## Sample Tables

This method works equally well for local Access tables and linked SQL Server tables.

Consider these two sample tables. *MyLocalTable* is a local Access table, while *MySqlServerTable* is a linked SQL Server table.

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/02/image-109.png)

Each table has a field named *MyDefaultDecimal* which represents a default Decimal field (if you don't define the Precision and Scale of a [Decimal type](https://docs.microsoft.com/en-us/sql/t-sql/data-types/decimal-and-numeric-transact-sql?view=sql-server-ver15), it defaults to a precision of 18 and a scale of 0).

## The Code

The `GetDecimalAttributes()` function returns a user-defined type (`udtDecimalAttributes`) so that both *Precision* and *Scale* may be returned at the same time in a type-safe manner.

```vba
Type udtDecimalAttributes
    'The maximum total number of decimal digits
    '   to be stored (1 to 38)
    Precision As Byte
    
    'The number of decimal digits that are stored
    '   to the right of the decimal point (0 to Precision)
    Scale As Byte
End Type

'Scale and Precision are not available in the DAO Field object,
'   so we need to use ADO to get this information
Function GetDecimalAttributes(LocalTblName As String, _
            FldName As String) As udtDecimalAttributes
    Dim Cat As Object ' ADOX.Catalog
    Set Cat = CreateObject("ADOX.Catalog")
    Set Cat.ActiveConnection = CurrentProject.Connection

    Dim Col As Object  'ADOX.Column
    Set Col = Cat.Tables(LocalTblName).Columns(FldName)
    
    With GetDecimalAttributes
        .Precision = Col.Precision
        .Scale = Col.NumericScale
    End With
    
    Set Col = Nothing
    Set Cat = Nothing
End Function
```

If you're not [using vbWatchdog like I am](https://nolongerset.com/error-handling-evolution/), you will want to add your own error-handling code.

## Sample Usage

To demonstrate usage of the `GetDecimalAttributes()` function, I created a couple of test procedures:

```vba
Sub PrintDecimalAttributes(TblName As String, FldName As String)
    With GetDecimalAttributes(TblName, FldName)
        Debug.Print TblName; "."; FldName; ": ", .Precision, .Scale
    End With
End Sub

Sub TestDecimalAttributes()
    PrintDecimalAttributes "MyLocalTable", "MyDefaultDecimal"
    PrintDecimalAttributes "MyLocalTable", "MyCustomDecimal"
    PrintDecimalAttributes "MySqlServerTable", "MyDefaultDecimal"
    PrintDecimalAttributes "MySqlServerTable", "MyCustomDecimal"
End Sub
```

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/02/image-110.png)

---

### External references

[Column Object (ADOX) - ActiveX Data Objects (ADO)Column Object (ADOX)Microsoft Docsrothja![](https://docs.microsoft.com/en-us/media/logos/logo-ms-social.png)](https://docs.microsoft.com/en-us/sql/ado/reference/adox-api/column-object-adox?view=sql-server-ver15)

[decimal and numeric (Transact-SQL) - SQL ServerTransact-SQL reference for the decimal and numeric data types. Decimal and numeric are synonyms for numeric data types that have a fixed precision and scale.Microsoft DocsMikeRayMSFT![](https://docs.microsoft.com/en-us/media/logos/logo-ms-social.png)](https://docs.microsoft.com/en-us/sql/t-sql/data-types/decimal-and-numeric-transact-sql?view=sql-server-ver15)

*Image by [NomeVisualizzato](https://pixabay.com/users/nomevisualizzato-9517909/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=4592723) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=4592723)*