Michael Paravicini
asked on
ValidationRule and FormError event behave differently in 64bit version then 32bit version
I'm using a customised validation rule in access. Whenever an error occurs I call the Forms FormError event and handle the error message according to the language of the user. For example if a variable is declared as numeric and the user enters characters, access will automatically call the formError event. However, I have recently changed to the new 64bit version and here the error is handled without calling the FormError event and no message at all is displayed. Is this correct or is there anything I can do to have the same behaviour as in the 32bit version? Thank you so much for any help!
I generally avoid validation rules (either in the data tables or in the forms).
Instead, I use the Form_BeforeUpdate event and a custom function to determine whether to allow a record to be saved. That code looks something like:
Instead, I use the Form_BeforeUpdate event and a custom function to determine whether to allow a record to be saved. That code looks something like:
Private Sub Form_BeforeUpdate(Cancel as Integer)
Cancel = NOT PassesChecks
End Sub
Private Function PassesChecks() as Boolean
if trim(me.SomeControl & "") = "" then
msgbox "Enter a value in 'Some Control'"
me.someControl.setfocus
end sub
elseif trim(me.someothercontrol & "") = "" Then
msgbox "Enter a value in 'SomeOtherControl'"
me.someothercontrol.setfocus
exit sub
elseif NZ(me.txtStartDate, #01/01/2000#) > NZ(me.txtEndDate, Date()) Then
msgbox "Start date must preceed current date!"
me.txtStartDate.Setfocus
exit sub
else
PassesChecks = true
End If
End Function
ASKER
Thank you Alex and there is no need to use the 64bits version. However, if one of my client uses this version it should show the same behaviour. Why would such a fundamentally different behaviour exist? It seems that the ValidationRule does not fire any event (although it does check the validation rule and will enforce integrity with no comments). It actually does not even display the validation text. Thanks anyway...
ASKER
Thank you Dale and I understand your point. However, the formerror allows me to give instant feedback while the user is still at the textbox rather than at the end ofthe form. Thanks anyway... Cheers Michael
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you to both of you. Your help is as always much appreciated! Cheers Michael
https://www.msoutlook.info/question/should-i-install-the-32bit-or-64bit-version-of-office
Now, why are you using 64bit is something we need to know, i'd personally recommend installing 32bit and then go from there, these sorts of issues are relatively common between the two.