Enumerating field property values

dan-cat

Registered User.
Local time
Today, 02:07
Joined
Jun 2, 2002
Messages
3,415
Ok,

I've had my turkey sandwiches and mince pies and I still can't figure out what I am doing wrong with this DAO statement. All I am trying to do is list the values of each property for a given field.

Why am I getting a type mismatch error with the prp variable?

Public Sub Help()

Dim db As Database
Dim prp As Property

Set db = CurrentDb()

For Each prp In db.TableDefs("tblHelp").Fields("Santa").Properties
Debug.Print prp.Name; prp.Value
Next
End Sub


Bah! Humbug
 
dan-cat,

When you loop through the properties
collection for a table's field, you'll
see that it has for properties:

Inherited: T/F
Name: Its name
Type: Type of data - Integer value
Value: ??

It has a value property, but not in
this context. If you looped through an
open form's fields and checked the
properties, they would be quite different,
and would have something for Value, OldValue,
Visible, etc.

Is this working towards documenting your
database? Or just experimentation?

Wayne
 
Thanks Wayne - this looks very useful.

I was just experimenting really.

At work we have a sub-contractor programmer.
Whenever she wants to install a field into our database. She emails me a separate database with one table and one field contained therein.
It's my job to ctrl+c the 'source field' and ctrl+v into our live database. (v. boring)

I was experimenting with creating some code which would do this automatically. (Copy an unpopulated field from one db to another)I was playing with the CreateField command. However this only seems to set three properties of the field and I would like to make sure that all the properties of the new field match all of the properties of the source field.

I thought I could do this by looping through all of the properties of the two fields and copying one to the other.

I've searched the forum but I couldn't find the thread that you did.

Thanks Wayne
 

Users who are viewing this thread

Back
Top Bottom