
Problem with Property-Object Type-Property
I think i have a problem with the property-object property Type, Access 97
with service pack 2 instaled after
service pack 1.
I'm determining the .Name, .Value and .Type for each property in
form.properties or report.properties
The name for .Type is set by comparence between its value and the build in
constants for settings and
resultvalues for Field-, Parameter- of Property-objects. I'm left confiused
by the results. See them
at the bottom of this message.
I'm working on this code for automatic recreating an object in an access
database that in one or the other
way doesn't function as it should be after redesigning. (For instance refers
to a control source that isn't
in the recordsource and isn't in any control that exist and many more.)
The information retrieved by the code is stored in an table. The table is
used for recreation.
********************
Option Compare Database
Option Explicit
Option Base 1
Dim IPEStr As String
Dim IPEItemName As String
Dim dbObjsMatrix() As String
<CODE>
Private Sub Eigenschappen_Click()
On Error GoTo EigenschappenError
Const objTabelProloog As String = "ObjDef"
Dim Bron As String
Dim BronNr As Long
Dim CodeRegelTeller As Long
Dim ctl As Control
Dim ctlId As Long
Dim dbs As Database
Dim fld As Field
Dim GroupLevelTeller As Byte
Dim grpl As GroupLevel
Dim IdTeller As Long
Dim mdl As Module
Dim msg As String
Dim obj As Object
Dim objId As Long
Dim objNaam As String
Dim objType As String
Dim Prp As Property
Dim rstObjDef As Recordset
Dim sctn As Section
Dim SectieTeller As Integer
Dim Tabelnaam As String
Dim tdf As TableDef
<SOME CODE>
Case "Form"
DoCmd.OpenForm (objNaam), acDesign, , , , acHidden
Set obj = Forms(objNaam)
Case "Report"
DoCmd.OpenReport (objNaam), acViewDesign
Set obj = Reports(objNaam)
<MORE CODE>
Select Case objType
Case "Form", "Report"
On Error GoTo ItemPropertiesError
For Each Prp In obj.Properties
IPEStr = ""
IPEItemName = Prp.Name
.AddNew
!ID = IdTeller
!ParentId = objId
!ObjectType = "Property"
!Name = Prp.Name
If Not IsNull(Prp.Value) Then !Extra1 = CStr(Prp.Value)
'If Not IsNull(Prp.Type) Then !Extra2 = CStr(Prp.Type)
<!!!!! Value as string>
If Not IsNull(Prp.Type) Then !Extra2 =
prpOmschrijving(Prp.Type) <!!!!! Converted>
!ErrorBericht = IPEStr
.Update
IdTeller = IdTeller + 1
Next Prp
On Error GoTo EigenschappenError
End Select
<EVEN MORE CODE>
End Sub
<CODE>
Private Function prpOmschrijving(prpType As Long) As String
Select Case prpType
Case dbBigInt
prpOmschrijving = "Big Integer"
Case dbBinary
prpOmschrijving = "Binary"
Case dbBoolean
prpOmschrijving = "Boolean"
Case dbByte
prpOmschrijving = "Byte"
Case dbChar
prpOmschrijving = "Char"
Case dbCurrency
prpOmschrijving = "Currency"
Case dbDate
prpOmschrijving = "Date / Time"
Case dbDecimal
prpOmschrijving = "Decimal"
Case dbDouble
prpOmschrijving = "Double"
Case dbFloat
prpOmschrijving = "Float"
Case dbGUID
prpOmschrijving = "Guid"
Case dbInteger
prpOmschrijving = "Integer"
Case dbLong
prpOmschrijving = "Long"
Case dbLongBinary
prpOmschrijving = "Long Binary (OLE Object)"
Case dbMemo
prpOmschrijving = "Memo"
Case dbNumeric
prpOmschrijving = "Numeric"
Case dbSingle
prpOmschrijving = "Single"
Case dbText
prpOmschrijving = "Text"
Case dbTime
prpOmschrijving = "Time"
Case dbTimeStamp
prpOmschrijving = "Time Stamp"
Case dbVarBinary
prpOmschrijving = "VarBinary"
Case Else
prpOmschrijving = "Type instelling of resultaatwaarde voor een
Field-, Parameter- of Property-object komt niet voor in Access-lijst"
End Select
End Function
********************
In this case the following line of code is commented out:
'If Not IsNull(Prp.Type) Then !Extra2 = CStr(Prp.Type)
Resulting in the following table:
"ID";"ParentID";"ObjectType";"Name";"Extra1";"Extra2";"Extra3";"ErrorBericht
"
226;1;"Property";"RecordSource";"Rechnung";"Date / Time";;""
227;1;"Property";"Filter";"([rechnungsnummer]=Forms![rechnung].[Rechnungsnum
mer])";"Date / Time";;""
228;1;"Property";"FilterOn";"Onwaar";"Long Binary (OLE Object)";;""
229;1;"Property";"OrderBy";"";"Date / Time";;""
230;1;"Property";"OrderByOn";"Onwaar";"Long Binary (OLE Object)";;""
231;1;"Property";"Caption";"";"Date / Time";;""
232;1;"Property";"RecordLocks";"0";"Byte";;""
233;1;"Property";"PageHeader";"0";"Byte";;""
234;1;"Property";"PageFooter";"0";"Byte";;""
235;1;"Property";"DateGrouping";"0";"Byte";;""
236;1;"Property";"GrpKeepTogether";"0";"Byte";;""
237;1;"Property";"MinButton";"Waar";"Long Binary (OLE Object)";;""
238;1;"Property";"MaxButton";"Waar";"Long Binary (OLE Object)";;""
239;1;"Property";"Width";"10319";"Byte";;""
********************
In this case the following line of code is commented out:
'If Not IsNull(Prp.Type) Then !Extra2 = prpOmschrijving(Prp.Type)
Resulting in the following table:
"ID";"ParentID";"ObjectType";"Name";"Extra1";"Extra2";"Extra3";"ErrorBericht
"
226;1;"Property";"RecordSource";"Rechnung";"8";;""
227;1;"Property";"Filter";"([rechnungsnummer]=Forms![rechnung].[Rechnungsnum
mer])";"8";;""
228;1;"Property";"FilterOn";"Onwaar";"11";;""
229;1;"Property";"OrderBy";"";"8";;""
230;1;"Property";"OrderByOn";"Onwaar";"11";;""
231;1;"Property";"Caption";"";"8";;""
232;1;"Property";"RecordLocks";"0";"2";;""
233;1;"Property";"PageHeader";"0";"2";;""
234;1;"Property";"PageFooter";"0";"2";;""
235;1;"Property";"DateGrouping";"0";"2";;""
236;1;"Property";"GrpKeepTogether";"0";"2";;""
237;1;"Property";"MinButton";"Waar";"11";;""
238;1;"Property";"MaxButton";"Waar";"11";;""
239;1;"Property";"Width";"10319";"2";;""
********************
Property RecordSource, Value="Rechnung", Type=8 or "Date / Time" ???
property OrderByOn, Value="Onwaar", Type=11 or "Long Binary (OLE Object)"
??? <Dutch "Onwaar" = English "False>
Property Width, Value=10319, Type=2 or Byte ???
Shouldend it be RecordSource.Type = Text?
Shouldend it be OrderByOn.Type = Boolean?
Shouldend it be Width.Type = Integer or Long?
Hopefully somebody knows what is going on
Greetings, Niels Leeflang.