The variable myPUScore is how I was testing the DLookup to make sure it was
retrieving the correct value.
Private Sub PURaw_AfterUpdate()
Dim myGender As String
Dim myAge As Integer
Dim myPUScore As Integer
myGender = DLookup("[APFTFormQuery]![Gender]", "[APFTFormQuery]",
"[AlphaRosterID] = " & Forms!APFT_Main!AlphaRosterID)
myAge = DLookup("[APFTFormQuery]![Age]", "[APFTFormQuery]", "[AlphaRosterID]
= " & Forms!APFT_Main!AlphaRosterID)
If myGender = "Male" Then
If myAge <= 21 Then
Forms!APFT_Main!PUScore = DLookup("[PushUp]![Group 1M]", "[PushUp]",
"[PushupID]= " & Forms!APFT_Main!PURaw)
'The Else statement checks for the age of the female and runs the
appropriate DLookUp
Else
If myAge <= 21 Then
myPUScore = DLookup("[PushUp]![Group 1F]", "[PushUp]", "[PushupID]= " &
Forms!APFT_Main!PURaw)
End Sub
Forms!APFTMainform.APFTSubform!PUScore = Dlookup(...)is required to write to
the control in the subform and now the code works as desired.