[AccessD] Code Help Please More Information

Drew Wutka DWUTKA at Marlow.com
Fri Feb 29 09:18:06 CST 2008


Joe, I think you need to use the Cancel parameter, instead of changing
the value (because the trigger is occurring while someone is changing
the value).  So either Cancel=True, or Cancel=False should do the trick.

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:23 AM
To: accessD at databaseadvisors.com
Subject: [AccessD] Code Help Please More Information

I just saw I get the same error on case VB Yes. How can allow the change
if
that is what they really want to do? See the rest here.

 

The following code is supposed warn when the value of a particular text
gets
changed. You almost never want the value changed after the record is
created.

 

 

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

        Me.txtQBInvoice.Value = Me.txtQBInvoice.Value

        

    Case vbNo

        Me.txtQBInvoice.Value = Me.txtQBInvoice.OldValue

   

   End Select

  

  End If

  End If

  

End Sub

 

I get error 2115  The Macro or function in the before update is
preventing
access from saving the record.  This message occurs when I click the no
button and debug hilites the case vbNo.

 

What I want on the no click is for the value to be set to the old value
and
move to the next field.

 

If this is a new record and there was no old value this check should not
run.

 

TIA

 

Joe Hecht

Joe at anamericanjoe.us

 

 

 

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.





More information about the AccessD mailing list