
Trouble adding InputMask property to fields...
A while back I wrote that I was unable to set the InputMask
Property of a field using DAO and then view it from the database
explorer.
It took a while to solve this little puzzle, but here is the
answer in case anyone is interested...
The basic problem was that I was changing the name property
of the field and also setting property values as well as
appending new properties such as InputMask and Description.
Well, I found many examples of how to do this, and even
complete subroutines that I could call to do this for me,
but it never would work. That is, it would never work as
long as I was changing the Name property as well.
Bottom line, if you change the name property of a field,
it loses all of its "extra" properties and maybe even some
its default properties.
I proved this by simply commenting out the name changing line
of my code and viola all the new properties that I had been
trying to add stuck.
What's the workaround to this? Maybe some others have better
ideas - I am rather new the Access, but what I came up with
was to append a new field to the table that contains the
field you want to change the name of. Use the new name for
this new field. Then copy all data from the old field to
the new field. Then dump the old field. The new field will be
ready and willing to have all sorts of properties added to
it.
Note: This trick is similar to that used when changing the
type of a field, ie., from LONG to INTEGER for example.
Steve Penners