Drew Wutka
DWUTKA at Marlow.com
Sat Mar 1 14:19:17 CST 2008
Sorry, why are you sending the escape key? Is Access prompting to cancel the update? Why not just turn off the warnings before you cancel, then set them back on afterwards. Sendkeys can cause some other issues, so it should be avoided. (Also, if the prompt is occurring from something you are doing in code, then Sendkeys probably won't work, because if the prompt is dialog, then your code will be paused until the dialog box is closed. Drew -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Hecht Sent: Saturday, March 01, 2008 12:54 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Code help Almost there Drew, It got me moved along. Thanks In the VB No Block After the cancel = true I need to "press" the escape key in code. All the send keys stuff I found is in a macro. I could not find the macro to code tool. Can you or anyone help? ======================================================================== ==== THIS CODE CHECKS TO MAKE A SURE A CHANGE IN EXISTING VALUE IN THE TEXT BOX IS INTENDED. NORMALLY IF IT IS AN EXISTING RECORD IT SHOULD NOT CHANGE. ======================================================================== ==== Private Sub txtQBInvoice_BeforeUpdate(Cancel As Integer) If Me.txtQBInvoice = "" Then Else If Me.txtQBInvoice.Value <> Me.txtQBInvoice.OldValue Then Dim lngRetval As Long lngRetval = MsgBox( _ "The Quick Books Invoice Number has changed." & vbCrLf & "" & vbCrLf & "Do you want to change this Value?", _ vbYesNo + vbExclamation + vbDefaultButton2, _ "QB Invoice Number has been changed") Select Case lngRetval Case vbYes Cancel = False Case vbNo Cancel = True I need to "Press" the escape key here. End Select End If End If End Sub Joe Hecht Joe at anamericanjoe.us -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka Sent: Saturday, March 01, 2008 10:31 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Code help Almost there So did using Cancel work? Drew -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Hecht Sent: Friday, February 29, 2008 8:21 PM To: accessD at databaseadvisors.com Subject: [AccessD] Code help Almost there Thanks Drew, I have three books on my desk, looked at help and still can not find this one. In the case no block, I need to send the escape key. Everything I see says send keys is a macro. I can not find the code. TIA Joe Private Sub txtQBInvoice_BeforeUpdate(Cancel As Integer) If Me.txtQBInvoice = "" Then Else If Me.txtQBInvoice.Value <> Me.txtQBInvoice.OldValue Then Dim lngRetval As Long lngRetval = MsgBox( _ "The Quick Books Invoice Number has changed." & vbCrLf & "" & vbCrLf & "Do you want to change this Value?", _ vbYesNo + vbExclamation + vbDefaultButton2, _ "QB Invoice Number has been changed") Select Case lngRetval Case vbYes Cancel = False Case vbNo Cancel = True ' SendKeys (esc) End Select End If End If End Sub Joe Hecht Joe at anamericanjoe.us -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.