Log in

View Full Version : Set source of text field values in a form on the fly?



mud2
12-10-2006, 06:50 PM
I can set the record source of a form on the fly (to my choice of tables), but how do I set the source of a text field in this Form. I want, ultimately, to set both the table and the field in that table as variables...determined by some programming action. I'm looking for something like
Text1.value = TableX.Fields(Y). Where TableX has been set, and Text1 is a text field in that table, in the form.
Thanks!

mud2
12-10-2006, 07:55 PM
Fill an array with the field names (strings), and refer to them by thier index in the array.

JimmyTheHand
12-11-2006, 01:48 PM
:hi:
I think you need the ControlSource property of those textboxes. If the RecordSource of the form has been set to any table, you can set the ControlSource of a textbox to any field in the table. This can be done in design mode as well as via VBA

Me.textboxname.ControlSource = "FieldName" Of course, you have to know name of the field.