Guillem
Member
- Local time
- Today, 07:02
- Joined
- Mar 28, 2020
- Messages
- 32
Hello, I have a trouble trying to do the following
it is intended for punctual use to convert some 2003 mdb databases to new look of 2019 templates
I will try to explain the scenario
I have a accdb that contains a form with a sample of type of controls formatted as desired (i.e. Ion theme with Office colors). To maintain it simple, the same for reports is not showed
A routine that loops trough all tagged controls in this form and creates a table (tblCtrlProps) with all data found (ControlTypeID, PropertyName, PropValue). This part is working fine.
Another form allows to select an external database (Test.accdb converted from .mdb) to apply template.
I would like to convert it by the following way. (I tried others ways but also don't worked, maybe by the same kind of error....)
Dim appAccess As Object 'Access.Application
Dim db As Object
Dim obj As AccessObject
Dim frm As Access.Form
Dim Ctrl As Access.Control
Dim Prop As DAO.Property
Dim FormName As String
Dim CtrlName As String
Dim PropName As String
Dim PropValue As Variant
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "C:\Test\Test.accdb", True
Set db = appAccess.CurrentProject
'Fem Forms
For Each obj In db.AllForms
appAccess.DoCmd.OpenForm obj.Name, acDesign
Set frm = appAccess.Forms(obj.Name)
FormName = frm.Name
For Each Ctrl In frm.Controls
CtrlName = Ctrl.Name
For Each Prop In Ctrl.Properties
' the process worked well until this sentence. I received the error attached
PropName = Prop.Name
PropValue = PropertyValue(CtrlName, PropName)
If PropValue = "NOT FOUND" 'do nothing
Else
Prop.Value = PropValue
End If
Next ' For Each Ctrl-Prop
Next 'For Each Ctrl
appAccess.DoCmd.Close acForm, frm.Name, acSaveYes
Next
PropertyValue() takes the value from original table tblCtrlProps and return it if it exist, otherwise "NotFound"
The whole process is a little more complex that it allows to choose which properties to apply, and which forms in the destination database to be applied.
someone can help?
Thanks in advance
it is intended for punctual use to convert some 2003 mdb databases to new look of 2019 templates
I will try to explain the scenario
I have a accdb that contains a form with a sample of type of controls formatted as desired (i.e. Ion theme with Office colors). To maintain it simple, the same for reports is not showed
A routine that loops trough all tagged controls in this form and creates a table (tblCtrlProps) with all data found (ControlTypeID, PropertyName, PropValue). This part is working fine.
Another form allows to select an external database (Test.accdb converted from .mdb) to apply template.
I would like to convert it by the following way. (I tried others ways but also don't worked, maybe by the same kind of error....)
Dim appAccess As Object 'Access.Application
Dim db As Object
Dim obj As AccessObject
Dim frm As Access.Form
Dim Ctrl As Access.Control
Dim Prop As DAO.Property
Dim FormName As String
Dim CtrlName As String
Dim PropName As String
Dim PropValue As Variant
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "C:\Test\Test.accdb", True
Set db = appAccess.CurrentProject
'Fem Forms
For Each obj In db.AllForms
appAccess.DoCmd.OpenForm obj.Name, acDesign
Set frm = appAccess.Forms(obj.Name)
FormName = frm.Name
For Each Ctrl In frm.Controls
CtrlName = Ctrl.Name
For Each Prop In Ctrl.Properties
' the process worked well until this sentence. I received the error attached
PropName = Prop.Name
PropValue = PropertyValue(CtrlName, PropName)
If PropValue = "NOT FOUND" 'do nothing
Else
Prop.Value = PropValue
End If
Next ' For Each Ctrl-Prop
Next 'For Each Ctrl
appAccess.DoCmd.Close acForm, frm.Name, acSaveYes
Next
PropertyValue() takes the value from original table tblCtrlProps and return it if it exist, otherwise "NotFound"
The whole process is a little more complex that it allows to choose which properties to apply, and which forms in the destination database to be applied.
someone can help?
Thanks in advance
Last edited: