Hello All,
I have a caption on my form that is attached to an option button. I have the form coded so that this caption has it's value depend on a field on the same form.
I actually got it to work but if I change the value of the control field that the caption depends on, I would like the caption to update itself immediatley. This part does not work. I have tried updating and refreshing the form but the caption does not change.
I have the following code in the 'On Current' event of the form as well as the 'After Update' field of the control field.
Private Sub SiteID_AfterUpdate()
' Set Owner Caption to site's initials
Dim OwnerCaption As Variant
OwnerCaption = DLookup("SiteInitials", "tblSite", "[SiteID] = " _
& Me.SiteID)
If IsNull(Me.SiteID) Then
Me.lblOrgOwnerSite.Caption = "Site"
Else
Me.lblOrgOwnerSite.Caption = OwnerCaption
End If
' Requery the Owner Caption
Me.Refresh
The last 2 lines were my attempt to refresh but it did not work.
Anyone have any ideas of how to refresh the caption on a form (or note any problem with the code).
Thanks very much!
Arch
I have a caption on my form that is attached to an option button. I have the form coded so that this caption has it's value depend on a field on the same form.
I actually got it to work but if I change the value of the control field that the caption depends on, I would like the caption to update itself immediatley. This part does not work. I have tried updating and refreshing the form but the caption does not change.
I have the following code in the 'On Current' event of the form as well as the 'After Update' field of the control field.
Private Sub SiteID_AfterUpdate()
' Set Owner Caption to site's initials
Dim OwnerCaption As Variant
OwnerCaption = DLookup("SiteInitials", "tblSite", "[SiteID] = " _
& Me.SiteID)
If IsNull(Me.SiteID) Then
Me.lblOrgOwnerSite.Caption = "Site"
Else
Me.lblOrgOwnerSite.Caption = OwnerCaption
End If
' Requery the Owner Caption
Me.Refresh
The last 2 lines were my attempt to refresh but it did not work.
Anyone have any ideas of how to refresh the caption on a form (or note any problem with the code).
Thanks very much!
Arch