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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating properties

Status
Not open for further replies.

romnew

Programmer
Feb 27, 2002
44
ZA
Hi all,
I have created new fields ia a table using code with the function createfields. I wish to create the properties, Format and DecimalPlaces for these fields, but...am at a total loss of how I do this. Any code direction will be greatly appreciated. Thanks again for a great site.
 
Here is something that I was playing around with. Throw a button and a form, pick a table, and run this code. See what happends.


Code:
Dim i, j As Integer
For j = 0 To CurrentDb.TableDefs("Misc").Fields.Count - 1
    For i = 0 To CurrentDb.TableDefs("Misc").Fields(j).Properties.Count - 1
        Debug.Print CurrentDb.TableDefs("Misc").Fields(j).Name & "  Is Index " & j & "  ", _
            CurrentDb.TableDefs("Misc").Fields("FieldValue").Properties(i).Name & "  Is index " & i & " For the field"
    Next i
Next j
CurrentDb.TableDefs("Misc").Fields("FieldValue").Properties("DecimalPlaces") = 6
CurrentDb.TableDefs("Misc").Fields("FieldValue").Properties(15) = True

as you will see in the debug screen different stuff is available according to the field type... also there are some things missing like Caption. I have no idea how you would change the field caption in code.

Anyhow. I was just playing around and thought you migh see something useful in here.
 
hi allanon,
I have been out of town for a few days.
Have only now received your suggestions.
Thanks I will try it out.
Must say I thought it could ge as straight forward as the creating fields code.
Newertheless here goes,
Romnew
 
Hi allanon,
Just to let you know that your code works fine where the properties exit.If not one has to use the createProperty method.
Thanks again for your direction
 
No Problem. It was my first time playing with properties like that in code also so I learned something.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top