Re: Table decimal places



"Hank" <hankrunner@xxxxxxx> wrote in message <1156079412.674061.23950@xxxxxxxxxxxxxxxxxxxxxxxxxxx>:
Doesn't the DecimalPlaces property give that?

Dim td As DAO.TableDef
Dim db As DAO.Database
Dim fd As DAO.Field
Set db = DBEngine(0)(0)
For Each td In db.TableDefs
For Each fd In td.Fields
If fd.Type = dbSingle Then
Debug.Print td.Name, fd.Name, _
fd.Properties("DecimalPlaces").Value
End If
Next fd
Next td

--
Roy-Vidar

Roy,
I tried your function and got "Property Not Found" for the
"DecimalPlaces" property. Actually it didn't recognize "Caption" or
other properties I thought should be there. I tried listing the
properties and found out that "DecimalPlaces" was number 23 but could
not get the value. I tried using fd.Properties(1) - (25) and got
values up to (8) but it would not recognize (9) and up.
As a test, I added a new table with singles in it and your
function reads it just fine. I tried to characterize the other tables to see what the difference was but I could not find anything
significant.
Any ideas?
Hank

Some properties, like the Caption property, doesn't exist until they are
set or created, either through the interface, or programatically. So,
those fields where you haven't set any caption, will return a 3270 -
property not found error.

For the Decimal Places property, it is a bit different. I think that if
you create the table through design view in Access, the property is set
regardless of whether you actually alter the value there or not. If you
on the other hand create the table through DDL, then it's not.

I don't work with these properties much programatically, but I think
that if your purpose is to just list the property values, I think that
you can safely assume that 3270 for the caption property, means no
caption is set, and for Decimal Places property for double/single
fields, then it's the default "Auto".

If you use on error resume next, and check for err.number = 3270, then
you should be able to determine which properties exists or not.

--
Roy-Vidar


.



Relevant Pages

  • RE: Field Caption
    ... > Does anyone know how to get and set the caption property of a field in a ... caption of the field in a table using VBA. ... Dim dbs As Database ... Dim prpCaption As Property ...
    (microsoft.public.access.modulesdaovba)
  • Re: How do I set up openrecordset with the table as a variable?
    ... Error 3011 is "The Microsoft Jet database engine could not find the object". ... Does the object type that it is have a Caption property? ... > Dim rst As Recordset ...
    (microsoft.public.access.modulesdaovba)
  • Re: Adding Fields property DecimalPlaces using the fields collection
    ... The Access Design view allows a size of Long ... doesn't make sense to set the DecimalPlaces property for such a field. ... Dim lrstSource As DAO.Recordset ... Dim lprpDestination As DAO.Property ...
    (microsoft.public.access.modulesdaovba)
  • Re: Creating Currency Column using ADOX for Access
    ... A Jet Currency field always stores 4 decimal places, ... wrong) the Format and DecimalPlaces properties are not exposed via ADOX. ... Dim tdf As DAO.TableDef ... I have been able to go into Access and modify the database after ...
    (microsoft.public.data.ado)
  • Re: Table decimal places
    ... Dim td As DAO.TableDef ... I tried listing the ... properties and found out that "DecimalPlaces" was number 23 but could ... I added a new table with singles in it and your ...
    (comp.databases.ms-access)

Loading