Dynamically referring to a named control

  • Thread starter Thread starter Matt Vinyl
  • Start date Start date
M

Matt Vinyl

Hi, I have a calendar form which is displayed whenever a user selects
the caledar button next to a number of different date fields on a
seperate form. I then would like the date transfered to the text box
from which they launched the calendar form.
I have code which dumps the name of the text box they click on into an
unbound control on the calendar form. Now how can I target the
previous control using the string in the text box to dump the date in,
when the user clicks my 'Select' button?

Basically, how do I dynamically change the control name?

Text1.value = "Hello!"

Name_of_control_as_variable.value = "Hello!"

Many Thanks for your help...

Matthew Finch
Oxleas NHS Trust
Bexley
Kent
England
 
You can use the controls collection to reference the control. For example:

Me.Controls("MyTextBox").Value

Hope this helps,
- Glen
 
Back
Top