D
deb
using access 03
Dirk Goldgar help me with a function that gives a message if the subform
does not have a child record. This works beautifully. Thank you Dirk!!
code below
Private Function RequireChildRecord(Optional Unloading As Boolean)
Dim GoBackID As Variant
GoBackID = Null
If Len(LastRecordID & vbNullString) > 0 Then
If (LastRecordID <> Nz(Me.ProjectID, 0)) Or Unloading Then
If DCount("*", "t51KeyMilestones", "ProjectID=" & LastRecordID)
= 0 Then
If MsgBox( _
"PM080 and PM670 Milestones are not entered! Go
Back?", _
vbExclamation + vbYesNo, _
"Milestone Entry Required") _
= vbYes _
Then
GoBackID = LastRecordID
End If
End If
End If
End If
If Not IsNull(GoBackID) Then
If Unloading Then
DoCmd.CancelEvent
End If
Me.Recordset.FindFirst "ProjectID=" & GoBackID
Else
LastRecordID = Me.ProjectID
End If
End Function
I have a Find Record button that opens a popup form that finds a record
using the below code when user clicks on record in popup.
Private Sub ShowRecord4_Click()
Dim Rst As DAO.Recordset
' Store the recordset for the form.
Set Rst = Forms!f040ProjectMain.RecordsetClone
' Locate the record for the selected.
Rst.FindFirst "ProjectID = " & List4
' Set the form's Bookmark property to move to the record.
Forms!f040ProjectMain.Bookmark = Rst.Bookmark
' Close the dialog box.
DoCmd.Close acForm, "f40ProjectGoTo"
End Sub
Now for my issue...
When the user clicks the Find Record button the msg is triggered by the
Function RequireChildRecord, as it should, however the popup form pops up.
How can I keep the pop up from popping up if the function call is true? If
there is no child records, prevent the popup.
Dirk Goldgar help me with a function that gives a message if the subform
does not have a child record. This works beautifully. Thank you Dirk!!
code below
Private Function RequireChildRecord(Optional Unloading As Boolean)
Dim GoBackID As Variant
GoBackID = Null
If Len(LastRecordID & vbNullString) > 0 Then
If (LastRecordID <> Nz(Me.ProjectID, 0)) Or Unloading Then
If DCount("*", "t51KeyMilestones", "ProjectID=" & LastRecordID)
= 0 Then
If MsgBox( _
"PM080 and PM670 Milestones are not entered! Go
Back?", _
vbExclamation + vbYesNo, _
"Milestone Entry Required") _
= vbYes _
Then
GoBackID = LastRecordID
End If
End If
End If
End If
If Not IsNull(GoBackID) Then
If Unloading Then
DoCmd.CancelEvent
End If
Me.Recordset.FindFirst "ProjectID=" & GoBackID
Else
LastRecordID = Me.ProjectID
End If
End Function
I have a Find Record button that opens a popup form that finds a record
using the below code when user clicks on record in popup.
Private Sub ShowRecord4_Click()
Dim Rst As DAO.Recordset
' Store the recordset for the form.
Set Rst = Forms!f040ProjectMain.RecordsetClone
' Locate the record for the selected.
Rst.FindFirst "ProjectID = " & List4
' Set the form's Bookmark property to move to the record.
Forms!f040ProjectMain.Bookmark = Rst.Bookmark
' Close the dialog box.
DoCmd.Close acForm, "f40ProjectGoTo"
End Sub
Now for my issue...
When the user clicks the Find Record button the msg is triggered by the
Function RequireChildRecord, as it should, however the popup form pops up.
How can I keep the pop up from popping up if the function call is true? If
there is no child records, prevent the popup.