Re: Adding Fields property DecimalPlaces using the fields collection
- From: "jeff" <jeff@work>
- Date: Tue, 16 Jan 2007 10:04:45 +0900
Thx Douglas for the input!
When viewing an equivalent field in the table design view, the field is set
to Number and has a field size of Long Integer with Decimal Places set to 2.
The data in the field is showing 2 decimal places, so it appears that it is
correct.
I understand what you are saying in that an Integer by definition is a whole
number and therefore no decimal places...but I am not sure that Access
understands this.. <grinning>. The Access Design view allows a size of Long
Integer to be specified and Decimal Places of 2 to be set.
It is baffling me...but i May just have to find a workaround...more to
come...
cheers
Jeff
"Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx> wrote in message
news:%23kvH$RQOHHA.4172@xxxxxxxxxxxxxxxxxxxxxxx
Given that a Long Integer cannot have any decimal places, it really
doesn't make sense to set the DecimalPlaces property for such a field.
I'm wondering if that's the problem?
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"jeff" <jeff@work> wrote in message
news:OhDfgNQOHHA.324@xxxxxxxxxxxxxxxxxxxxxxx
Alex
I have changed my code to match yours....
Dim ldbsCurrent As DAODatabase
Dim lrstSource As DAO.Recordset
Dim lfldSource As DAO.Field
Dim lstrDestination As String
Dim lrstDestination As DAO.Recordset
Dim ltdfDestination As DAO.TableDef
Dim lfldDestination As DAO.Field '<<<<<<< added
Dim lprpDestination As DAO.Property
Dim lstrCurrentEntityClass As String
Dim lstrNewEntityClass As String
'using the source fields collection, create fields in the new
table definition
For Each lfldSource In lrstSource.Fields
Set lfldDestination =
ltdfDestination.CreateField(lfldSource.Name, lfldSource.Type)
If lfldSource.Type = dbLong Then
Set lprpDestination =
lfldDestination.CreateProperty("DecimalPlaces", dbByte, 0)
lfldDestination.Properties.Append lprpDestination
'<<<<<<<< fails at this line with error below
End If
ltdfDestination.Fields.Append lfldDestination
ltdfDestination.Fields(lfldSource.Name).AllowZeroLength =
True
Next
'append the new destination table to the tables collection and
'open a new recordset (implicitly closes the previous open
recordset)
ldbsCurrent.TableDefs.Append ltdfDestination
Set lrstDestination =
ldbsCurrent.OpenRecordset(lstrDestination)
Error:
Error# 3219 was generated by DAO.Property
Invalid operation.
It looks as though it should work...but...
.
- References:
- Adding Fields property DecimalPlaces using the fields collection
- From: jeff
- Re: Adding Fields property DecimalPlaces using the fields collection
- From: Alex Dybenko
- Re: Adding Fields property DecimalPlaces using the fields collection
- From: Aussie Jeff
- Re: Adding Fields property DecimalPlaces using the fields collection
- From: Alex Dybenko
- Re: Adding Fields property DecimalPlaces using the fields collection
- From: jeff
- Re: Adding Fields property DecimalPlaces using the fields collection
- From: Douglas J. Steele
- Adding Fields property DecimalPlaces using the fields collection
- Prev by Date: varying expressions in tables
- Next by Date: RE: varying expressions in tables
- Previous by thread: Re: Adding Fields property DecimalPlaces using the fields collection
- Next by thread: Re: Adding Fields property DecimalPlaces using the fields collection
- Index(es):
Relevant Pages
|