G
Guest
I have some code on a form that makes a certain label flash depending on the
value of a combo box using the BeforeUpdate event:
Private Sub cboTypeOfCall_BeforeUpdate(Cancel As Integer)
If cboTypeOfCall.Value = "Sales" Then
Call SALEScolour
End If
End Sub
Sub SALEScolour()
Dim i As Integer
For i = 1 To 6
If lblSALESColour.BackColor = 255 Then
lblSALESColour.BackColor = -2147483633
Else
lblSALESColour.BackColor = 255
End If
Call ColourChanger(0.4)
Next
End Sub
Sub ColourChanger(TickTime As Double)
Dim TimeNow As Double
TimeNow = Timer
Do While Timer < TimeNow + TickTime
DoEvents
Loop
End Sub
If I change the value of the combo box before the lable has finished
flashing I get the following error.:
"The macro or function set to the BeforeUpdate or ValidationRule property
for this field is preventing DB1 from saving data in the field.
* If this is a macro, open the macro in the Macro window and remove the
action that forces a save (for exemple, GoToControl).
* If the macro inclides a SetValue action, set the macro to the AfterUpdate
property of the control instead.
* If this is a function, redefine the function in the Module window."
I have tried putting OnError events on all the related functions but none of
them will overide this error message appearing. How do I stop this happening?
--
Adam Thwaites
Access Database Designer
adam.*spamless*[email protected]
Manchester, UK
(I have no access to other sites apart from microsoft.com so posting
external links is no use to me)
value of a combo box using the BeforeUpdate event:
Private Sub cboTypeOfCall_BeforeUpdate(Cancel As Integer)
If cboTypeOfCall.Value = "Sales" Then
Call SALEScolour
End If
End Sub
Sub SALEScolour()
Dim i As Integer
For i = 1 To 6
If lblSALESColour.BackColor = 255 Then
lblSALESColour.BackColor = -2147483633
Else
lblSALESColour.BackColor = 255
End If
Call ColourChanger(0.4)
Next
End Sub
Sub ColourChanger(TickTime As Double)
Dim TimeNow As Double
TimeNow = Timer
Do While Timer < TimeNow + TickTime
DoEvents
Loop
End Sub
If I change the value of the combo box before the lable has finished
flashing I get the following error.:
"The macro or function set to the BeforeUpdate or ValidationRule property
for this field is preventing DB1 from saving data in the field.
* If this is a macro, open the macro in the Macro window and remove the
action that forces a save (for exemple, GoToControl).
* If the macro inclides a SetValue action, set the macro to the AfterUpdate
property of the control instead.
* If this is a function, redefine the function in the Module window."
I have tried putting OnError events on all the related functions but none of
them will overide this error message appearing. How do I stop this happening?
--
Adam Thwaites
Access Database Designer
adam.*spamless*[email protected]
Manchester, UK
(I have no access to other sites apart from microsoft.com so posting
external links is no use to me)