PDA

View Full Version : Is it possible to restrict a user from displaying data in an inorderly way?



wedd
01-20-2011, 02:10 AM
Hi everyone, I have 2 drop down list boxes on my form, one is starting times (drop down list box 1) and the other is ending times (drop down list box 2). I would like to restrict the user from entering a later time (drop down list box one) e.g starting time 2pm ending time 11am... I would rather it was starting time 11am and ending 2pm. And if the user had entered 2pm starting time and 11 am ending time an error message would display. Is there a validation rule, expression, vba code etc that I can use to do this? If so, how can this be done? Would you have any similar examples of how this can be done?


Thanks for your contributions:friends:

CreganTur
01-20-2011, 07:18 AM
Good question. This is another example of a data validation routine and you have a number of options on how to handle this. 2 options are:

1) put change event code on the comboboxes so that when the user makes a selection it compares both values and if box1 > box2 then box2's value is changed to be the same value or greater than by some default increment

2) when the user submits the values to your form, probably by clicking a button, it compares the values and if box1 > box2 you throw a messagebox and cancel the sub to keep the record from being submitted.

wedd
01-21-2011, 01:22 AM
Thanks, CreganTur! Would you have a simple example with the use of vba code or even simpler know a validation rule I could use to do this or possible know a website I could get this useful info about how to do this? I'm an intermediate user trying to learn more...