View Full Version : my code is working but missing something...please see and help me out!


gino
05-11-2000, 02:55 PM
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
05-11-2000, 04:40 PM
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
05-11-2000, 04:47 PM
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
05-11-2000, 06:48 PM
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
....