J
johnlute
WinXP Office 2003
I use the following code in a database and it works fine. I'm trying
to use it in another database and it isn't working. Specifically, the
GoBackID isn't working. Instead of going back, the form navigates
away.
Does anyone see what needs changed to correct the problem?
Thanks in advance!
Private Function RequireChildRecord(Optional Unloading As Boolean)
Dim GoBackID As Variant
GoBackID = Null
Dim strMessage As String
If Len(LastRecordID & vbNullString) > 0 Then
If (LastRecordID <> Nz(Me.txtProfileID, 0)) Or Unloading Then
If DCount("*", "tblProfilesSensitivities", "txtProfileID='"
& LastRecordID & "'") = 0 Then
strMessage = vbCr & "Sensitivity information is
required!"
GoBackID = LastRecordID
Me.sfrmProfilesSensitivities.SetFocus
End If
End If
End If
If Len(LastRecordID & vbNullString) > 0 Then
If (LastRecordID <> Nz(Me.txtProfileID, 0)) Or Unloading Then
If DCount("*", "tblProfilesAllergens", "txtProfileID='" &
LastRecordID & "'") = 0 Then
strMessage = vbCr & "Allergen information is
required!"
GoBackID = LastRecordID
Me.sfrmProfilesAllergensRMING.SetFocus
End If
End If
End If
If Len(strMessage) > 0 Then
MsgBox Mid(strMessage, 2), vbCritical + vbOKOnly
End If
If Not IsNull(GoBackID) Then
If Unloading Then
DoCmd.CancelEvent
End If
Me.Recordset.FindFirst "txtProfileID='" & GoBackID
Else
LastRecordID = Me.txtProfileID
End If
End Function
I use the following code in a database and it works fine. I'm trying
to use it in another database and it isn't working. Specifically, the
GoBackID isn't working. Instead of going back, the form navigates
away.
Does anyone see what needs changed to correct the problem?
Thanks in advance!
Private Function RequireChildRecord(Optional Unloading As Boolean)
Dim GoBackID As Variant
GoBackID = Null
Dim strMessage As String
If Len(LastRecordID & vbNullString) > 0 Then
If (LastRecordID <> Nz(Me.txtProfileID, 0)) Or Unloading Then
If DCount("*", "tblProfilesSensitivities", "txtProfileID='"
& LastRecordID & "'") = 0 Then
strMessage = vbCr & "Sensitivity information is
required!"
GoBackID = LastRecordID
Me.sfrmProfilesSensitivities.SetFocus
End If
End If
End If
If Len(LastRecordID & vbNullString) > 0 Then
If (LastRecordID <> Nz(Me.txtProfileID, 0)) Or Unloading Then
If DCount("*", "tblProfilesAllergens", "txtProfileID='" &
LastRecordID & "'") = 0 Then
strMessage = vbCr & "Allergen information is
required!"
GoBackID = LastRecordID
Me.sfrmProfilesAllergensRMING.SetFocus
End If
End If
End If
If Len(strMessage) > 0 Then
MsgBox Mid(strMessage, 2), vbCritical + vbOKOnly
End If
If Not IsNull(GoBackID) Then
If Unloading Then
DoCmd.CancelEvent
End If
Me.Recordset.FindFirst "txtProfileID='" & GoBackID
Else
LastRecordID = Me.txtProfileID
End If
End Function