What I\'d like to do is display the description from the currently selected field in a label on my form. I feel that where it is currently being displayed (the bottom left statu
The text in the status bar is the current field's Description
property.
From VBA, you can access the Description
of a field in the form's recordset.
Debug.Print Me.Recordset.fields("id").Properties("Description")
So, if you have a label control named lblDescription
, you can set its .Caption
value to the field's Description
.
Me.lblDescription.Caption = Me.Recordset.fields("id").Properties("Description")
However, this could be more complicated. Description
is a user-created property, which means that it doesn't exist until you give it a value. And, if you have one set, but delete its value later, the property itself no longer exists.
If you attempt to retrieve the Description
when one doesn't exist, VBA will throw error #3270, "Property not found." You could trap that error, and set Me.lblDescription.Caption
to vbNullString
when it happens.
You also need a strategy for when to change Me.lblDescription.Caption
. You could create a procedure to set it based on the current active control. Then call that procedure from the on focus event of each of your form's controls. There may be a better approach for this, but I'm not seeing one just now.