I have the following line of code in a module to open a dialog box:
Do While rstCBAPPS.EOF = False
If rstCBAPPS.Fields("ACAP No") = Val(strACAP) Then
'Open error dialog with error message
strErrorMessage = "Duplicate Found! Press Cancel to enter title manually."
DoCmd.OpenForm "frmduperror", WindowMode:=acDialog
'0 = Dup, 1 = Contin, 2 = New, 3 = Cancel
If intResponce = 3 Then
MsgBox ("Title Number: " + publicTitleNumber + " has not been entered.")
publicTitleNumber = Val(publicTitleNumber) + 1
rstCBAPPS.Close
Exit Function
End If
End If
rstCBAPPS.MoveNext
Loop
With the following code in the doalog box form:
Private Sub cmdDup_click()
intResponce = 0
DoCmd.Close
End Sub
Private Sub cmdContin_click()
intResponce = 1
DoCmd.Close
End Sub
Private Sub cmdNew_click()
intResponce = 2
DoCmd.Close
End Sub
Private Sub cmdCancel_Click()
intResponce = 3
DoCmd.Close
End Sub
Private Sub Form_Load()
Label12.Caption = strErrorMessage
End Sub
When the responce on the newly opened dialog window is cmdCancel (3) everything continues normally. However if anything else is chosen, you have to click on the command button 6 times in order for it to register. If I try to dabug the code and walk though, the program exits on the DoCmd.Close statement. Does anyone know why this would be happening?
Note: intResponce is declared publicly
Do While rstCBAPPS.EOF = False
If rstCBAPPS.Fields("ACAP No") = Val(strACAP) Then
'Open error dialog with error message
strErrorMessage = "Duplicate Found! Press Cancel to enter title manually."
DoCmd.OpenForm "frmduperror", WindowMode:=acDialog
'0 = Dup, 1 = Contin, 2 = New, 3 = Cancel
If intResponce = 3 Then
MsgBox ("Title Number: " + publicTitleNumber + " has not been entered.")
publicTitleNumber = Val(publicTitleNumber) + 1
rstCBAPPS.Close
Exit Function
End If
End If
rstCBAPPS.MoveNext
Loop
With the following code in the doalog box form:
Private Sub cmdDup_click()
intResponce = 0
DoCmd.Close
End Sub
Private Sub cmdContin_click()
intResponce = 1
DoCmd.Close
End Sub
Private Sub cmdNew_click()
intResponce = 2
DoCmd.Close
End Sub
Private Sub cmdCancel_Click()
intResponce = 3
DoCmd.Close
End Sub
Private Sub Form_Load()
Label12.Caption = strErrorMessage
End Sub
When the responce on the newly opened dialog window is cmdCancel (3) everything continues normally. However if anything else is chosen, you have to click on the command button 6 times in order for it to register. If I try to dabug the code and walk though, the program exits on the DoCmd.Close statement. Does anyone know why this would be happening?
Note: intResponce is declared publicly