BlueSpruce
Active member
- Local time
- Today, 09:45
- Joined
- Jul 18, 2025
- Messages
- 987
I cannot understand why the code below is running the report when pressing the enter key despite setting the default button to "No" .
Code:
Private Sub cmdPrintReceipt_Click()
Dim response as String
response = MsgBox("Print Customer Receipt?", vbYesNo + vbDefaultButton2)
If response = vbYes Then DoCmd.OpenReport "rptPrintCustomerReceipt", , , "[ContractNo] = " & Me.ContractNo
End Sub
Last edited: