I posted this in a previous thread but I think this forum is the more appropriate place for my question. I have the following code that runs when a button is clicked on a form:
Code:
Public Sub MyCode()
Dim strMessage As String
Dim varX As Variant
strMessage = "New identifier required?"
If MsgBox(strMessage, vbYesNo + vbQuestion, "Confirm") = vbYes Then
strMessage = "Change first digit."
MsgBox strMessage, vbInformation, "Action Required"
Else
strMessage = "Major change to a capability?"
If MsgBox(strMessage, vbYesNo + vbQuestion, "Confirm") = vbYes Then
strMessage = "Change second digit."
MsgBox strMessage, vbInformation, "Action Required"
Else
If DLookup("ECN_Class_I_Change", "ENGINEERING_CHANGE_NOTICE_TABLE", "[ECN_Class_I_Change] = -1") Then
If DLookup("ECN", "ENGINEERING_CHANGE_NOTICE_TABLE", "[ECN] = Forms!DRAWING_STATUS![Subform_DRAWING_STATUS_ECN]!ECN") Then
strMessage = "Change third digit."
MsgBox strMessage, vbInformation, "Action Required"
Else
strMessage = "Minor change to hardware/drawings?"
If MsgBox(strMessage, vbYesNo + vbQuestion, "Confirm") = vbNo Then
strMessage = "Error. Please try again."
MsgBox strMessage, vbInformation, "Action Required"
Else
If DLookup("PCP", "REVIEW_PANEL_TABLE", "[PCP] = -1") Then
If DLookup("GWSHW_BL", "REVIEW_PANEL_TABLE", "[GWSHW_BL] = Forms!DRAWING_STATUS![Subform_DRAWING_STATUS_CONFIGURATION_HWCI_BL]!BL_HWCI_HWCI") Then
If DLookup("GWSHW_HW", "REVIEW_PANEL_TABLE", "[GWSHW_HW] = Forms!DRAWING_STATUS![Subform_DRAWING_STATUS_CONFIGURATION_HWCI_BL]!BL_HWCI_HWCI") Then
strMessage = "Change fourth digit - HWCI/BL has been certified."
MsgBox strMessage, vbInformation, "Action Required"
Else
strMessage = "Change fifth digit"
MsgBox strMessage, vbInformation, "Action Required"
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
I bolded the sections that I think are causing the issue. When the button is clicked, it runs through the first two If statements without issue. However, nothing happens after. There is no error or message box. I am attempting to use multiple Dlookup statements to match fields from multiple places as the criteria for the if/then/else statement. I have only ever done this using one Dlookup statement, so I am not sure what I am doing wrong or if Dlookup functions can be combined this way.