VALIDATION AND CALCULATED FIELDS

D

DIY

Hi Guys,
Can anyone help please?

A) I have 2 tick boxes to capture “AUTHORISED ABSENCE†and “UNAUTHORISED
ABSENCEâ€. I also have an ABSENCE REASON text box.

If AUTHORISED ABSENCE or UNAUTHORISED ABSENCE is selected, then the ABSENCE
REASON box must not be empty. The message “Select A Reason†must be
displayed, else leave blank

I have tried,
=IIf([AUTHORISED ABSENCE]="-1" Or [UNAUTHORISED ABSENCE]="-1","Select A
Reason",""). However this does not work.


B) I have a text box (JOB NUMBER) for storing Job Numbers and a calculated
text box (BALANCE), which = 0 when a Job number is selected and the form is
completed. This works.
I need to create a validation to say to ensure that BALANCE =0, if a Job
Number is selected and the form is completed.

C) On Save, as a final check, I need the following validation.

IF Authorised Absence, Unauthorised Absence or JOB NUMBER is not selected,
Then the message “Check Job†must be displayed as one of the 3 must always
be selected.

Any suggestion is welcome.
Many thanks
 
S

Svetlana

1) Put as control source for the textbox
=IIf([AUTHORISED ABSENCE]=-1 Or [UNAUTHORISED ABSENCE]=-1; "Select A
Reason";"")

2) On after update event of JOB NUMBER textbox try the code
If Nz(Me.JOB NUMBER)<>0 Then
Me.BALANCE=0
Else
Me.BALANCE=Null
End If

3) On before update event of the form you could check the value of the
fields you wish to be selected as like
If Me.BALANCE<>0 Then
Cancel=True
MsgBox "Check Job"
Else
If Me.[AUTHORISED ABSENCE]=0 Then
If Me.[UNAUTHORISED ABSENCE]=0 Then
Cancel=True
MsgBox "Check Job"
End If
End If
End If
 
L

Larry Daugherty

Posts in UPPERCASE - Subject and/or Body - are frequently deleted,
unread and without response. That's what I do about 99 times out of
100. The 100th gets a message like this but still doesn't get read
nor receive a response from me.

HTH
 
D

DIY

Thanks, Svetlana,
That helped a treat.
Thanks for the advice Larry.
--
DIY


Larry Daugherty said:
Posts in UPPERCASE - Subject and/or Body - are frequently deleted,
unread and without response. That's what I do about 99 times out of
100. The 100th gets a message like this but still doesn't get read
nor receive a response from me.

HTH
--
-Larry-
--

DIY said:
Hi Guys,
Can anyone help please?

A) I have 2 tick boxes to capture "AUTHORISED ABSENCE" and "UNAUTHORISED
ABSENCE". I also have an ABSENCE REASON text box.

If AUTHORISED ABSENCE or UNAUTHORISED ABSENCE is selected, then the ABSENCE
REASON box must not be empty. The message "Select A Reason" must be
displayed, else leave blank

I have tried,
=IIf([AUTHORISED ABSENCE]="-1" Or [UNAUTHORISED ABSENCE]="-1","Select A
Reason",""). However this does not work.


B) I have a text box (JOB NUMBER) for storing Job Numbers and a calculated
text box (BALANCE), which = 0 when a Job number is selected and the form is
completed. This works.
I need to create a validation to say to ensure that BALANCE =0, if a Job
Number is selected and the form is completed.

C) On Save, as a final check, I need the following validation.

IF Authorised Absence, Unauthorised Absence or JOB NUMBER is not selected,
Then the message "Check Job" must be displayed as one of the 3 must always
be selected.

Any suggestion is welcome.
Many thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top