Using MS Access/Get field name from a subform
Here's my problem, I have a subform.. what I want is whenever i select a record the field name should appear on a textbox. Its like status bar but on a form. You will notice on the image the column sizes is small because users are just going to input numbers and I don't it to take so much space. I want the user to have a clue on what is the current selected field/column. How do i accomplish that?
My recommendation is to NOT use Datasheet view. Use a continuous form for the subform. Then you make your labels on multiple lines or you can stagger the labels over multiple rows. For example:
I almost never use datasheet view because its so limiting.
But if you still want to do it your way. Put a textbox on the main form and name it txtCurrent. Then in the Gotfocus event of each control on the subform use the Code Builder to enter this line of code:
Forms!mainformname!txtCurrent = Screen.ActiveContol.Caption
Hope this helps,
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA