checking subform for records

  • Thread starter Thread starter johnlute
  • Start date Start date
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
 
Looks like you got answers to this q. in the MS forums, John

Hi, Allen. Yes, thanks. I can't get a read on what's going on relative
to the life/death of these forums so I posted it in both.
 
Hi, Allen. Yes, thanks. I can't get a read on what's going on relative
to the life/death of these forums so I posted it in both.

The microsoft.public.access.* forums haven't gone anywhere.

The change is that Microsoft is no longer maintaining their own server, but
many other ISPs are.
 
The microsoft.public.access.* forums haven't gone anywhere.

The change is that Microsoft is no longer maintaining their own server, but
many other ISPs are.

Hi, Doug. Thanks for the clarification. It seems to me that these
Google Usenet groups appear to be withering - maybe I have the wrong
perception. I'm in the process of finding a new "home" but will
continue looking and posting here, too.
 
johnlute said:
Hi, Doug. Thanks for the clarification. It seems to me that these
Google Usenet groups appear to be withering - maybe I have the wrong
perception. I'm in the process of finding a new "home" but will
continue looking and posting here, too.

Since Microsoft has stopped providing their web interface to their
newsgroups, as well as shut down their free NNTP servers, the volume has
definitely dropped.

However, just to be clear, this is NOT a "Google Usenet group". Google
simply archives what's posted to the NNTP newsgroups (as well as providing
an interface to allow posting to the newsgroups)
 
However, just to be clear, this is NOT a "Google Usenet group". Google
simply archives what's posted to the NNTP newsgroups (as well as providing
an interface to allow posting to the newsgroups)

True. I find it challenging however to suggest to people that they
should check out "the NNTP newsgroups archive via Google's interface"!
Most people find me sufficiently complicated and confusing without
adding more logs to that fire.
 
:
I find it challenging however to suggest to people that they
should check out "the NNTP newsgroups archive via Google's
interface"! Most people find me sufficiently complicated and
confusing without adding more logs to that fire.

People find *me* confusing and complicated, too.

Not to mention annoying and tiresome.
 
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

BTW this was resolved (if anyone's interested). The line:
Me.Recordset.FindFirst "txtProfileID='" & GoBackID

needed changed to:
Me.Recordset.FindFirst "txtProfileID='" & GoBackID & "'"

DOH!!!
 
Hey, David. you forgot to mention intelligent and
extrordinaily knowledgable, but maybe that's part of being
complicated ;-)

You're much kinder than my critics...thanks!

Truth be told, in real life, I can be difficult, but only about
things I care about. When I get bent out of shape about something in
Access, it's because it's something I care a lot about. Same in real
life -- nobody wastes energy on things toward which they are
indifferent.

BTW, an experienced salesperson once taught me the lesson when in
initial discussions with a potential new client that if they start
complaining about something, you've made the sale, as if they
weren't onboard, they wouldn't be motivated to bitch and moan.

It's a bit simplistic, but it is a viewpoint that makes it easier to
tolerate certain kinds of client reactions.
 
Back
Top