Can i rename a control on the fly ? For example, if Me!Office = 6 Then Me.Branch9 = Me!Branch. Both branch9 and branch are fields in the table products
I'm not sure exactly what you're asking for here. At one extreme, you can create a form from scratch and even write event handlers for the controls, all dynamically, in Access. (Note that writing event handlers kills any digital signature you added to your code, so users will get the macro virus warning.)
Do you mean changing the caption of a control? That's easy: just Me!Foo.Caption = "whatever". That link is for label controls, the same syntax works for any controls with a caption like buttons.
Do you mean changing the name property? No, it's read-only. You would have to delete the control and create a new one with a different name, which is tricky.
If you want to refer to different controls depending on some variable, exactly how you do it is up to you, but you can store a reference to a control in an object variable. For example:
Public hotControl as Control
Sub setHotControl(ByRef newHotControl as Control)
' **MUST** use the Set command to assign object references in VBA.
Set hotControl = newHotControl
hotControl.Visible = True
If VarType(hotControl) = "ComboBox" Then
Dim hotCombo as ComboBox
Set hotCombo = hotControl
' Do stuff that only a ComboBox can do