Hi. I'm trying to change the default visible property in a form by vba. I tried many many many many ways but no success. My idea is to make this default visible property in a form wich is not yet open if the user is administrador.
When the database starts it has a login screen in wich if the user is administrator, then the default property of a tab (Modificado) in a form (Registo_teste_criancas_tudo) is changed. This form is not yet opened nor it will be after login form.
The form's name is "Registo_teste_criancas_tudo" and the tab's name inside the form wich I want to be visible is "Modificado".
Plz see attachment. "Visível" in English = VisibleThe test code is something like this :
Case "Admin"
Forms!Registo_teste_criancas_tudo.Controls!Modificado.Visible = True
'this hides the panel and so on ....
DoCmd.ShowToolbar "Ribbon", acToolbarYes
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowUnhide
DoCmd.SetDisplayedCategories 1, "Lar da Criança"
For i = 1 To CommandBars.count
CommandBars(i).Enabled = True
CommandBars(i).Visible = True
Next i
I even tried this one :
Dim frm As Form, ctlDefault As control
Set frm = Forms(Registo_teste_criancas_tudo)
Set ctlDefault = frm.DefaultControl(Modificado)
With ctlDefault
.Visible = True
End With
How can I change the property of a control in a form without opening that form?
When the database starts it has a login screen in wich if the user is administrator, then the default property of a tab (Modificado) in a form (Registo_teste_criancas_tudo) is changed. This form is not yet opened nor it will be after login form.
The form's name is "Registo_teste_criancas_tudo" and the tab's name inside the form wich I want to be visible is "Modificado".
Plz see attachment. "Visível" in English = Visible
"Sim" = Yes
"Não" = No
Case "Admin"
Forms!Registo_teste_criancas_tudo.Controls!Modificado.Visible = True
'this hides the panel and so on ....
DoCmd.ShowToolbar "Ribbon", acToolbarYes
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowUnhide
DoCmd.SetDisplayedCategories 1, "Lar da Criança"
For i = 1 To CommandBars.count
CommandBars(i).Enabled = True
CommandBars(i).Visible = True
Next i
I even tried this one :
Dim frm As Form, ctlDefault As control
Set frm = Forms(Registo_teste_criancas_tudo)
Set ctlDefault = frm.DefaultControl(Modificado)
With ctlDefault
.Visible = True
End With
How can I change the property of a control in a form without opening that form?
Attachments
Last edited: