Changing a control property using a dynamically created string

Changing a control property using a dynamically created string

Post by UmljayBTY2 » Wed, 14 Oct 2009 04:16:02


Is it possible to change a property of a control/tab usine a string? For
example, I tried:

Dim Test_Form As String
Test_Form = "forms![frm_Main_Contacts]"
Test_Form.Tab_Control_Subforms.Value = 0

where "Tab_Control_Subforms" is a tab control. This does not work. Is
there some way to do this?

Thanks,

Rick
 
 
 

Changing a control property using a dynamically created string

Post by Dirk Goldg » Wed, 14 Oct 2009 04:40:29


Using a variable for the form name:

Dim Test_Form As String
Test_Form = "frm_Main_Contacts"
Forms(Test_Form)!Tab_Control_Subforms.Value = 0


Using a variable for the form name, and another variable for the control
name:

Dim Test_Form As String
Dim ControlName As String

Test_Form = "frm_Main_Contacts"
ControlName = "Tab_Control_Subforms"

Forms(Test_Form).Controls(ControlName).Value = 0


--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 
 
 

Changing a control property using a dynamically created string

Post by UmljayBTY2 » Wed, 14 Oct 2009 05:20:01

Exactly what I needed; many thanks, Dirk.

Rick