I have two forms that I need to communicate between. The first form (Form A) will take several entries into a listbox. After each entry into the listbox, I need to raise an event that will tell Form B how many entries have been added currently. Here's what I have so far (it doesn't work):
Form A:
Form B:
Thanks,
Randy
Form A:
Code:
Public Event addedNumber(CurrentCount As Integer)
Private Sub txtTrackingNumber_LostFocus()
With Me.txtTrackingNumber
If .Text <> "" Then
frmMain.lbxTrackingNumbers.AddItem Me.txtTrackingNumber
RaiseEvent addedTrackingNumber(TrackingNumberCounter)
.Text = ""
.SetFocus
TrackingNumberCounter = TrackingNumberCounter + 1
End If
End With
End Sub
Form B:
Code:
Dim WithEvents ftn As frmTrackingNumber
Private Sub Form_Activate()
Set ftn = frmTrackingNumber
End Sub
Private Sub Form_Deactivate()
Set ftn = Nothing
End Sub
Private Sub ftn_addedTrackingNumber(CurrentCount As Integer)
MsgBox CurrentCount
End Sub
Thanks,
Randy