my code is working but missing something...please see and help me out! (2 Viewers)

gino

Registered User.
Local time
Today, 09:25
Joined
Mar 16, 2000
Messages
117
i have one field named [TOTAL CORRECTIVE ACTIONS] and..... if this field is greater than 29 then i have a msg asking user "How many Corrective Actions have you completed?" and this automatically setfocus to [NUMBER OF CORRECTIVE ACTIONS]. now so far so good but if user attempts to enter a value in [NUMBER OF CORRECTIVE ACTIONS] field ...it still prompts them to enter daty in that field.... this code is in the got focus event of the save command button.

If Me![TOTAL CORRECTIVE ACTIONS] >= 30 then
Me![NUMBER OF CORRECTIVE ACTIONS] >= 0
else
MsgBox "How many Corrrective Actions have you completed?", vbOKOnly
Me![NUMBER OF CORRECTIVE ACTIONS].SetFocus
End If

Please help me out. Thanks to all in advance.

[This message has been edited by gino (edited 05-11-2000).]
 

R. Hicks

AWF VIP
Local time
Today, 03:25
Joined
Dec 23, 1999
Messages
619
If I understand what you are trying to do try:

If Me![TOTAL CORRECTIVE ACTIONS] > 29 then
MsgBox "How many Corrrective Actions have you completed?", vbOKOnly
Me![NUMBER OF CORRECTIVE ACTIONS].SetFocus
End If

HTH
RDH

[This message has been edited by R. Hicks (edited 05-11-2000).]
 

gino

Registered User.
Local time
Today, 09:25
Joined
Mar 16, 2000
Messages
117
yes that was my original code, but after user have input their numbers into [NUMBER OF CORRECTIVE ACTIONS] i don't want that messege to pop up after clicking on the save button. thats where i am clueless. i tried tweaking out my original code...and now its totally messed up at this point as you see in my first post.....

i am looking for a validation rule....

thanks R. Hicks

[This message has been edited by gino (edited 05-11-2000).]
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:25
Joined
Feb 19, 2002
Messages
43,233
Your control source and control name are probably the same - [TOTAL CORRECTIVE ACTIONS]
Rename the control name to [txtTOTAL CORRECTIVE ACTIONS] and test the control name rather than the control source.

If Me![txtTOTAL CORRECTIVE ACTIONS] >= 30 then
....
 

Users who are viewing this thread

Top Bottom