Greetings Guru's
I have two forms that I am working with. The first is a Parent form. On the load event I have it check for records pertaining to a tail number and log number. That code works without fail each time and is listed below.
From this form I have a button that opens a pop up form and allows me to order a new part. When I submit the data and close the form I would like to re-run the code above. I have tried Refresh, OnGotFocus and OnActive. In each the case the code fails to run.
Can anyone suggest an event or a way to fire the code?
I have two forms that I am working with. The first is a Parent form. On the load event I have it check for records pertaining to a tail number and log number. That code works without fail each time and is listed below.
Code:
Private Sub Form_Load()
Dim t As String
Dim lp As String
Dim strWhere As String
Dim lngLen As Long 'long length
Dim rs As DAO.Recordset
Dim cnt As Long
MsgBox "The Code is running"
Me.Form.Filter = "(False)"
Me.FilterOn = True
If Not IsNull(Me.Parent.txt_tail.Value) Then
t = Me.Parent.txt_tail.Value
strWhere = strWhere & "([af_reg] = """ & t & """) AND "
'MsgBox ("The tail number is " & t)
End If
If Not IsNull(Me.Parent.txt_lp.Value) Then
lp = Me.Parent.txt_lp.Value
strWhere = strWhere & "([Logpg] = """ & lp & """) AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
Exit Sub
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
MsgBox "The Filter has been applied"
End If
If Not (Me.RecordsetClone.EOF Or Me.RecordsetClone.BOF) Then
Me.RecordsetClone.MoveLast
cnt = Me.RecordsetClone.RecordCount
MsgBox "There are " & cnt & " records for the form"
End If
If cnt <= 0 Then
MsgBox "The Tab is off"
Me.Parent.tab_New_Prts.Visible = False
Else
MsgBox "The Tab is On"
Me.Parent.tab_New_Prts.Visible = True
Me.Refresh
End If
'Me.RecordsetClone = Nothing
End Sub
From this form I have a button that opens a pop up form and allows me to order a new part. When I submit the data and close the form I would like to re-run the code above. I have tried Refresh, OnGotFocus and OnActive. In each the case the code fails to run.
Code:
Private Sub cmb_sub_Click()
'Dim args() As String
DoCmd.Save
DoCmd.Close
Forms(frm_NewPart_Mon).SetFocus
End Sub
Can anyone suggest an event or a way to fire the code?