I have multiple Members, and each one has a record which contains several memo fields:
Member ID Entry A Entry B
1 [memo text] [memo tex
As recommended in this post:
RaiseEvent
function. .Visible
to avoid closing out the Memo Entry form (which throws things off).Dim strFieldName As String, varValue
'Private WithEvents ... NAH, WE WON'T GO THERE
Private Sub btnView_A_Click()
strFieldName = "boxQuality_A"
varValue = Me(strFieldName)
Call OpenMemberInput(Me!boxID, strFieldName, varValue, True)
End Sub
Private Sub btnView_B_Click()
strFieldName = "boxQuality_B"
varValue = Me(strFieldName)
Call OpenMemberInput(Me!boxID, strFieldName, varValue, True)
End Sub
'Private Sub frmZoom_UpdateComment(lngID As Long, strAssessStage As String, varReturn)
' ... NAH, we won't be using this...
'End Sub
Private Sub Form_Close()
Dim obj As ObjecT
For Each obj In collectnMembers
If obj.Hwnd = Me.Hwnd Then
collectnMembers.Remove CStr(Me.Hwnd)
End If
Next
End Sub
Sub OpenMemberInput(lngID As Long, strStage As String, _
varComment, booEdit As Boolean)
Dim FoundMe As Boolean
FoundMe = v_MemberComment.FetchForm(lngID, strStage)
If FoundMe Then Exit Sub
Dim frmZoom As New Form_frmMemberInputZoom
Set frmZoom = New Form_frmMemberInputZoom
frmZoom.ID = lngID
frmZoom.Stage = strStage
frmZoom.Comment = varComment
frmZoom.Visible = True
collectnZooms.Add Item:=frmZoom, Key:=CStr(frmZoom.Hwnd)
End Sub
'' NAH, no use of the Public Event
'Public Event UpdateComment(lngID As Long, strAssessStage As String, varReturn)
Private lngAssess_ID As Long
Private strAssessStage As String
Private varComment
Public Property Let ID(ByVal MyAssessID As Long)
lngAssess_ID = MyAssessID
Me.boxID = lngAssess_ID
End Property
Public Property Let Stage(ByVal MyAssessStage As String)
strAssessStage = MyAssessStage
Me.boxAssessStage = strAssessStage
End Property
Public Property Let Comment(ByVal varExisting)
varComment = varExisting
Me.boxComment = varComment
End Property
Public Property Get Comment()
Comment = varComment
End Property
Private Sub boxComment_AfterUpdate()
varComment = Me.boxComment
Comment = varComment
End Sub
Private Sub CmdCancel_Click()
''TODO revert to before-update text if Cancel is selected
Me.Tag = "Cancel"
Me.Visible = False
End Sub
Private Sub CmdOK_Click()
Dim intCount As Integer, frm As Form, lngHwnd As Long
For intCount = 1 To collectnMembers.Count
Set frm = collectnMembers(intCount)
If frm![boxID] = lngAssess_ID Then
frm(strAssessStage) = varComment
frm.Requery
End If
Next
Me.Visible = False
End Sub
Private Sub Form_Close()
'RaiseEvent .... NAH, DON'T BOTHER
Dim obj As Object
For Each obj In collectnZooms
If obj.Hwnd = Me.Hwnd Then
collectnZooms.Remove CStr(Me.Hwnd)
End If
Next
End Sub
Public collectnZooms As New Collection
Public Function FetchForm(lngID As Long, strStage As String) As Boolean
Dim intCount As Integer
For intCount = 1 To collectnZooms.Count
If collectnZooms(intCount)![boxID] = lngID _
And collectnZooms(intCount)![boxAssessStage] = strStage Then
FetchForm = True
collectnZooms(intCount).Tag = ""
collectnZooms(intCount).Visible = True
Exit Function
End If
Next
End Function