Trouble adding InputMask property to fields... 
Author Message
 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



Sat, 01 Jul 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Referencing Field Properties InputMask and Format, using VB/VBA

2. Adding Field to Access db - need to make indexed property of field No Duplicates

3. InputMask Property

4. Why No InputMask Property in VB6?

5. Create Access field with Inputmask

6. Trouble with the Field Description property

7. Trouble Setting Field Properties

8. Adding special fields' properties via code

9. Add Field via DAO - Set Format Property

10. How could I add properties to field?

11. add field with autoincrement property

12. Adding and Changing field properties at runtime

 

 
Powered by phpBB® Forum Software