Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Datebase Field Properties

Status
Not open for further replies.

lrfcbabe

Programmer
Jul 19, 2001
108
US
I am combining multiple databases into one. I need to read the properties of source field and duplicate them in the new database. I am having troubles reading the properties.
This with error at Set prpDP because apparently DecimalPlaces is not a property. Type will get set to 7.
I am looking for something that will tell me what all of the field properties are and how I can mimic them.

Dim strfield As String
Dim prpfield As Field
Dim prpType As Property
Dim prpDP As Property
Dim prpIM As Property

strfield = ors.Fields(t).Name
Set prpfield = ors.Fields(strfield)
Set prpType = prpfield.Properties("Type")
Set prpDP = prpfield.Properties("DecimalPlaces")
Set prpIM = prpfield.Properties("InputMask")

I use this to set properties in another app and DecimalPlaces is one so why can't I read a property as DecimalPlaces?
Set prpfield = OutTD.Fields("dblSize")
Set prop = prpfield.CreateProperty("DecimalPlaces", dbByte, 3)
prpfield.Properties.Append prop

Thanks

 
DecimalPlaces" is a property only for numeric fields.

Further, it is not meaningful for Integer, Long, Date, Byte or Bit fields even though you can set it. Either they do not support decimal places (Integer, Long, Byte, Bit) or they use automatic decimal places (Date) where the DecimalPlaces property will appear as 255.

"Type" is an attribute of the field and also appears as a property.

You can reference it with
Code:
FieldName.Type
or with
Code:
FieldName.Properties("Type")

Type 7 is a double (probably your default numeric type) and usually the DecimalPlaces property defaults to 255 which indicates automatic determination of decimal places.

As to your being unable to read the DecimalPlaces property ... I suspect it is because non-numeric fields such as text, memo, GUID, etc. do not have such a property nor do they need one.
 
The ADO documentation says:
adDate value: 7

Indicates a date value (DBTYPE_DATE). A date is stored as a double, the whole part of which is the number of days since December 30, 1899, and the fractional part of which is the fraction of a day.

There is no DecimalPlaces property. You might be thinking of NumericScale or Precision instead.

ADO Properties

There are also Dynamic Properties, as well as Provider-Specific Properties like Jet OLEDB:Compressed UNICODE Strings.
 
dilettante

I infer that the OP is using DAO since CreateProperty is a DAO method that doesn't appear in ADO. DAO does indeed show a DecimalPlaces property that works as I described.

Due to its tighter integration with JET, DAO can retrieve properties that do not appear in ADO ... or at least I don't know how to get to them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top