I'm trying to make a rule that will change field properties (required, read only) and can't figure out how the correct usage. Any pointers?
it will eventually be part of if statements but for now...
I get ActiveX automation object var is Nothing
Sub mainDim depth As Fielddepth.Required = TrueEnd Sub
Hi Brett
These are DAO field properties, you loop through the properties for a field until you find the relevant one, and set the value.
docs.microsoft.com/.../field-object-dao
regards
Phil Wade
Phil WadeDatgelBentley Channel Partner and Developer PartnerE: phil.wade@datgel.com | T: +61 2 8202 8600 & +65 6631 9780
Get the most out of gINT with Datgel Tools.
DAO was what was needed.
This finally worked for me to get a property change from No to Yes.
...Now I just need to get the change to save it's lost if I click to another table or enter new data.and find where the read-only property lives (I don't spot it when I loop through field properties)
Function test Dim fld As DAO.Field Dim stable As String Dim sfield As String Dim prop As DAO.Property stable="Point" sfield="Location" Set fld = gINTRules.CurrentProject.TableDefs(stable).Fields(sfield) Debug.Print fld.Properties("Required").Value ''''''-1 is true fld.Properties("Required") ="-1" Debug.Print gINTRules.CurrentProject.TableDefs(stable).Fields(sfield).Properties("Required").Value End Function
Before going further, will it cause problems changing properties within an enterprise database? Can some projects have data marked required or read-only and other projects have data not be required or read-only for the same field?
For SQL Server, the field properties are stored in SQL Server db table WH_ColumnProperties. You can read and write using SQL select and update statements.