Dim Statment question

mercredi 4 mars 2015

I would like to run some code where the reference is to a sub form on another form. The path would be:




Code:



Forms![FrmMain]![frmSalesContactsSub].Form!


And I used as a Dim statement:


Code:



Dim sform as string

sform = "Forms![FrmMain]![frmSalesContactsSub].Form!"



Then when I want to reference the control on the subform I tried




Code:



ControlA = sform & ControlA


But nothing happens. If I use the full file path




Code:



ControlA = Forms![FrmMain]![frmSalesContactsSub].Form!ControlA


All is OK. But since I have about a half dozen controls to populate, the code looks cumbersome.



Is there a way to Dim the file path and then combine it with the control name?



Thanks.

Dim Statment question

0 commentaires:

Enregistrer un commentaire

Labels