473,396 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Validation And Calculated Fields

2
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
Sep 24 '06 #1
2 1816
PEB
1,418 Expert 1GB
Hi man,
A)
So in your form you choose the before update property and there choose event procedure
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2. If ((Me![AUTHORISED ABSENCE]=True) or (me![UNAUTHORISED ABSENCE]=True)) AND (isnull(Me![ABSENCE REASON])) Then
  3. msgbox “Select A Reason”
  4. Cancel=True
  5. end if
  6.  
  7. IF me![BALANCE]<>0 Then
  8. Cancel=True
  9. end if
  10.  
  11. IF (Me![Authorised Absence]=false) AND (Me![Unauthorised Absence]=False) AND (Isnull(ME![JOB NUMBER])) Then
  12. Msgbox “Check Job” 
  13. Cancel=true
  14. End Sub
  15.  

Best regards

:)


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
Sep 24 '06 #2
DIY
2
THANKS FOR THAT. SPOT ON.


Hi man,
A)
So in your form you choose the before update property and there choose event procedure
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2. If ((Me![AUTHORISED ABSENCE]=True) or (me![UNAUTHORISED ABSENCE]=True)) AND (isnull(Me![ABSENCE REASON])) Then
  3. msgbox “Select A Reason”
  4. Cancel=True
  5. end if
  6.  
  7. IF me![BALANCE]<>0 Then
  8. Cancel=True
  9. end if
  10.  
  11. IF (Me![Authorised Absence]=false) AND (Me![Unauthorised Absence]=False) AND (Isnull(ME![JOB NUMBER])) Then
  12. Msgbox “Check Job” 
  13. Cancel=true
  14. End Sub
  15.  

Best regards

:)
Sep 24 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Miguelito Bain | last post by:
hi everybody. i'm trying to find out what you can and can't do with/in calculated fields. any help, pointers, and/or advice would be greatly appreciated. i'm a newbie, but i want to learn, and...
5
by: John Bahran | last post by:
I am trying to use calculated fields in my query but all the results are zero ven when they're not. Please help. Thanks.
2
by: david | last post by:
Hi, I have a form with a couple of calculated fields. I want to put some code into the 'Form-Load' event to set various object states on the form, depending on the value of these fields. The...
2
by: Ryker | last post by:
I have a Purchase Order where I have a calculated field called Price that is calculated by multiplying Qty * Sales Price. I have 10 of these fields...Price 1 - Price 10 (for each line of the PO). ...
2
by: Olveres | last post by:
Hi, I have managed to work out how to add new lines into a calculated text box. However in this text box some of the outcome fields are empty however when previewing the report it includes the...
5
by: Henrik | last post by:
The problem is (using MS Access 2003) I am unable to retrieve long strings (255 chars) from calculated fields through a recordset. The data takes the trip in three phases: 1. A custom public...
2
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by...
3
by: Matthew Wells | last post by:
If I have a calculated field that returns a value from a udf, does that field get calculated even when it's not being used in a Select statement? I knw that if a calculated field's formula is...
2
by: mkbrady | last post by:
I have a query that includes calculated fields that generate numeric results. I have wrapped conversion functions CLng() and CDdl() around the calculated fields to ensure the data types are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.