A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

form coding on before update



 
 
Thread Tools Display Modes
  #1  
Old November 27th, 2007, 08:12 PM posted to microsoft.public.access.forms
scott04
external usenet poster
 
Posts: 197
Default form coding on before update

Hi everyone. I have a yes/no field on my form with 3 number fields related
to the the yes/no form. If the the yes/no form is True then i would like at
least one of the three number fields to have a number greater than 0. I have
it set so that if the yes/no is false it automatically sets the three number
fields to 0 but i am trying to set a rule that forces you to enter a number
in one or more of the three fields. Can someone give me a push in the right
direction? Thank you!
  #2  
Old November 27th, 2007, 08:39 PM posted to microsoft.public.access.forms
Ofer Cohen
external usenet poster
 
Posts: 1,683
Default form coding on before update

You can use the form BeforeUpdate event to check if the fields are filled, if
not then stop the process

If Me.[CheckBoxName] = True And (Nz(me.[TextBox1],0) + Nz(me.[TextBox2],0)
+ Nz(me.[TextBox3],0) = 0) then
MsgBox "You need to apply a number"
Cancel = True ' Stop the process
End If

--
Good Luck
BS"D


"scott04" wrote:

Hi everyone. I have a yes/no field on my form with 3 number fields related
to the the yes/no form. If the the yes/no form is True then i would like at
least one of the three number fields to have a number greater than 0. I have
it set so that if the yes/no is false it automatically sets the three number
fields to 0 but i am trying to set a rule that forces you to enter a number
in one or more of the three fields. Can someone give me a push in the right
direction? Thank you!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.