[RESOLVED] What event is fired when a modal form returns to the calling form
Hello all,
I have a form being opened modal by a calling form
Code:
Private Sub cmdWorkForm_Click()
If txtSCID.Text = "" Then
frmSubContractor.Refresh
End If
lngWrkid = CLng(txtSCID.Text)
frmSubWork.Show vbModal, frmSubContractor
End Sub
Once the frmSubWork form is closed I would like to know what event is fired by VB? The reason is I have an ADODC that feeds a read only datagrid showing all of the work a subcontractor has carried out.
The issue I am having is the datagrid, once the form is returned focus is not showing all of the records.
Code:
Private Sub UpdateDatagrid()
Dim strSQL As String
Dim lngSCID As Long
Dim dgRS As ADODB.Recordset
Set dgRS = New ADODB.Recordset
strSQL = "SELECT * FROM tblSCPay WHERE SubContractor = " & txtSCID.Text
With dgRS
.ActiveConnection = cn
.CursorType = adOpenForwardOnly
.CursorLocation = adUseClient
.LockType = adLockReadOnly
.Source = strSQL
.Open , , , , adCmdText
End With
Set dgdSCWork.DataSource = dgRS
With dgdSCWork
.Refresh
End With
dgRS.Close
Set dgRS = Nothing
End Sub
followed by
Code:
Private Sub Form_GotFocus()
Call UpdateDatagrid
End Sub
that achieves nothing, hence I need to know what event is firing.
Any assistance is very much appreciated.
Kind regards
Steve
Re: What event is fired when a modal form returns to the calling form
There is no event for it, and no need for one - because the very next line of code will run.
Just add your code immediately after showing the form:
Code:
...
frmSubWork.Show vbModal, frmSubContractor
Call UpdateDatagrid
End Sub
Re: What event is fired when a modal form returns to the calling form
Hello Si,
Perfect. Thanks very much.
Steve