Hey guys, my turn to ask a question =D
Ok here's my situation.. I have a super simple form, which is bound to a table with a single record. All the controls (mostly text boxes, some true/false checkboxes and combos) are bound straight to each field.
Now, in the table itself, each field has it's Description property filled out, instructing the user as to what data belongs in the field. I can pull this data on the form by using each control's .StatusBarText property. What I'd like to do is have a label in the form header, that updates OnEnter in each control, showing the user the full description of the currently selected control. (It does display in the statusbar on the bottom, but it gets cut off usually.)
I -dont- want to plug in the code in each control's Enter/Leave/GotFocus, etc events. I want to auto-populate these on Form Load, or, maybe catch some other type of event when I switch focus between controls and then pass this to a generic function.
If this can be done on form load, I imagine I'd start with something like the following:
So, can dynamically written events be done like this? I understand I can use a single function to pass the name of the control, etc.. But this is being set up so that an end user can go into the table, enter new fields, type a description, and simply drop the new control onto the form and it'll work without having to enter in any events for it.
Ok here's my situation.. I have a super simple form, which is bound to a table with a single record. All the controls (mostly text boxes, some true/false checkboxes and combos) are bound straight to each field.
Now, in the table itself, each field has it's Description property filled out, instructing the user as to what data belongs in the field. I can pull this data on the form by using each control's .StatusBarText property. What I'd like to do is have a label in the form header, that updates OnEnter in each control, showing the user the full description of the currently selected control. (It does display in the statusbar on the bottom, but it gets cut off usually.)
I -dont- want to plug in the code in each control's Enter/Leave/GotFocus, etc events. I want to auto-populate these on Form Load, or, maybe catch some other type of event when I switch focus between controls and then pass this to a generic function.
If this can be done on form load, I imagine I'd start with something like the following:
Code:
Private Sub SetControlEvents()
Dim i As Integer
For i = 0 To Controls.count - 1
If Controls(i).ControlType = acTextBox Or Controls(i).ControlType = acComboBox Then
'set event for control
End If
Next
End Sub
Comment