However, this thought just popped into my head. Go into that app, opened for development. Uncheck the VBA library.
The VBA library cannot be removed
Public Const vbDefaultButton2 = 256What if you declare it separately as the correct value e.g.
Public Const vbDefaultButton2 = 256
Then compile, compact and repair, and check it's value again?
Then remove the declaration and see if the correct value sticks?
Can you upload this database with only this form or part of it to see the issue?Yes, I tried. That was one of the earliest tests suggested to me. I only imported the form to a new accdb and the problem persisted. So something in that form must be corrupted.
I cannot, I signed an NDA with the customer and I have already exceeded my authority by posting minimal details about it.Can you upload this database with only this form or part of it to see the issue?
Public Sub cmdPrintReceipt_Click()
Dim response As VbMsgBoxStyle
response = MsgBox("DON'T Print Customer Receipt?", VbMsgBoxStyle.vbYesNo)
If response = VbMsgBoxResult.vbYes Then Exit Sub
DoCmd.OpenReport "rptPrintCustomerReceipt", , , "[ContractNo] = " & Me.ContractNo
End Sub
Public Sub cmdPrintReceipt_Click2()
Dim response As VbMsgBoxStyle
response = MsgBox("Print Customer Receipt?", VbMsgBoxStyle.vbYesNo + VbMsgBoxStyle.vbDefaultButton2)
If response = VbMsgBoxResult.vbNo Then Exit Sub
DoCmd.OpenReport "rptPrintCustomerReceipt", , , "[ContractNo] = " & Me.ContractNo
End Sub
Public Sub cmdPrintReceipt_Click3()
If MsgBox("Print Customer Receipt?", _
VbMsgBoxStyle.vbYesNo _
+ VbMsgBoxStyle.vbDefaultButton2) _
= VbMsgBoxResult.vbYes Then
DoCmd.OpenReport "rptPrintCustomerReceipt", , , "[ContractNo] = " & Me.ContractNo
End If
End Sub
There is something wrong with vbDefaultButton2's enum so I'm not using it in the "Don't Print Receipt" code.This may not compile if something is wrong with those enum definitions.