Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Update form properties after sub form close

$
0
0
This is sort of related to my earlier post.
I have form that launches a sub form via a button

Code:

Private Sub Edit_AddBtn_Click()
On Error GoTo Err_Edit_AddBtn_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "New Customer Popup"
    stLinkCriteria = "[CustomerID]=" & "'" & Me![CustomerID] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Edit_AddBtn_Click:
    Exit Sub
Err_Edit_AddBtn_Click:
    MsgBox Err.Description
    Resume Exit_Edit_AddBtn_Click
End Sub

The parent form has on it controls that make command buttons active/inactive based on the contents of a field

Code:

Private Sub Form_Current()

If IsNull(Me.EmailAddress) Or Me.EmailAddress = "" Then
    Me.SendMail.Enabled = False
    Else
    Me.SendMail.Enabled = True
End If
End Sub

What I have found is that if the field contents are changed in the sub form, and then the sub form is closed, the controls on the command buttons aren't updated.

I am using the requery command in the On Close event procedure of the sub form to update the parent form data (which works fine)
Code:

Private Sub Form_Close()
    Requery
End Sub

However the command button controls are still in the state they were prior to opening the sub form.

Does anyone know how I "refresh" the parent form to reflect the new state of the form contents.

Many thanks in advance.

Viewing all articles
Browse latest Browse all 13329

Trending Articles