Prev: new messenger
Next: Embedded Acrobat Viewer
From: Arvi Laanemets on 9 Mar 2010 09:48 Hi On a form I have 2 controls, txtHours & txtMinutes. Whenever there is entered 60 or more minutes into txtMinutes, I want full hours added to txtHours (or txtHours value replaced, I haven't decided yet), and set reminder as new value for txtMinutes. Something like: Private Sub txtMinutes_BeforeUpdate(Cancel As Integer) If Me.txtMinutes < 60 Then Else Me.txtHoues = Me.txtHoues + Int(Me.txtMinutes / 60) Me.txtMinutes = Me.txtMinutes Mod 60 End If End Sub Current code returns an error "The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Access from saving the data in the field." How must this be done? Thanks in advance! Arvi Laanemets
From: Dirk Goldgar on 9 Mar 2010 11:57 "Arvi Laanemets" <garbage(a)hot.ee> wrote in message news:OfNINe5vKHA.5340(a)TK2MSFTNGP04.phx.gbl... > Hi > > On a form I have 2 controls, txtHours & txtMinutes. Whenever there is > entered 60 or more minutes into txtMinutes, I want full hours added to > txtHours (or txtHours value replaced, I haven't decided yet), and set > reminder as new value for txtMinutes. Something like: > > Private Sub txtMinutes_BeforeUpdate(Cancel As Integer) > If Me.txtMinutes < 60 Then > Else > Me.txtHoues = Me.txtHoues + Int(Me.txtMinutes / 60) > Me.txtMinutes = Me.txtMinutes Mod 60 > End If > End Sub > > > Current code returns an error "The macro or function set to the > BeforeUpdate or ValidationRule property for this field is preventing > Microsoft Access from saving the data in the field." How must this be > done? You can't change the value of a control in its own BeforeUpdate event. You must use the control's AfterUpdate event instead. -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup)
From: Arvi Laanemets on 9 Mar 2010 13:17 Thanks! "Dirk Goldgar" <dg(a)NOdataSPAMgnostics.com.invalid> wrote in message news:AC55A41C-5CBC-4D27-8BAC-34FE2B09143B(a)microsoft.com... > You can't change the value of a control in its own BeforeUpdate event. > You must use the control's AfterUpdate event instead. > This was a surprise for me. It looked logical that all changes must be done before updating. Arvi Laanemets
|
Pages: 1 Prev: new messenger Next: Embedded Acrobat Viewer |