Comparing fields... ?

AJ IT Student

Registered User.
Local time
Today, 08:40
Joined
May 8, 2002
Messages
36
Hi all.

Thank you very much for all your help so far. My application has shaped up very nicely because of your help and advice - though there are still some little bits and bobs I need to iron out...

Anyway.. to the topic:

On one of my tables, for employees I have:
HolidayAllowed
HolidayTaken

as fields. Each HAS to be a 2 digit number.

What I'd like to do, is in some way, compare the two..
Basically the logic being:

If HolidayTaken > HolidayAllowed NOTIFY THE USER SOMEHOW

i.e. a message box..
Where would I put the code, and what sort of thing would I write? I still have very little clue about VBA.

Another idea - is it possible to 'disable' a field programmatically..? Say if HoldiayTaken = HolidayAllowed Then disable holidaytaken...

any simple + quick response hugely appreciated.

many thx.

aj
 
One thing to concider is when do you want to be notified? When the Db opens, once a week, once a day, when a form opens, if you press a "Check Holdays" button etc etc. Once this is eatablished the experience on the forum will assist you to construct some code that will loop through the records.
HTH
Dave
 
Thanks for the reply.

I would like to be notified when a value is entered into the form.

For example:

if the guy has 25 days of holiday a year.. and he puts in 25 days used - it would come up with a box saying - "all holiday used up" - and disable the field?

Also - if he tried to say he's had 26 days of holiday, it would pop up box saying: You cannot have more holiday than allocated.

See what I mean?
Thank you..
aj
 
Something like this may get you started.
Sorry about the field names, started down the wrong track, then read your reply post.
Hope it helps
Dave
 

Attachments

Don't be silly! Names - even I can manage to change those! :p

I'm very grateful for your effort.
That's exactly what I wanted.

Merci Beacoup!!

aj
 
Reply to PM

You need to base your second combo box on a query, then requery the second combo box.
Have added a bit more to the original Db

See how the first list box is based on a query.
After update refreshes the second listbox which has its record source based on another query (see below)

With the second list box, use the wizard to "Find a record on my form"
Once you have done this change the list boxes record source to the other query
Dave
 

Attachments

AJ
Had a quick look. Changed the way the emergency contact table is set up.
Hope it helps
Dave
 

Attachments

Users who are viewing this thread

Back
Top Bottom