I need some suggestions for avoiding the dreaded 2115 Error. I have a form text box bound to a date/time field in an Access 97 table. All along, I've been using the BeforeUpdate event to ensure that the time entered in the text box is not earlier than the time entered in a previous text box - if it is, a MsgBox is displayed and the event is cancelled. By itself, this approach works fine.
However, I also need to account for the fact that users may enter times either with or without an AM/PM indicator ("a", "am", "p" or "pm"). When the user does not specify such an indicator, Access assumes that the time is AM. So, if the previous text box contains 2:30 PM, and the user enters "3:00" in the subsequent text box, it is taken as 3:00 AM and the validation rule coded into the BeforeUpdate event procedure prevents the update. I've devised a means to determine whether AM or PM is appropriate (if the user does not specify), but when I attempt to use the BeforeUpdate event procedure to add "am" or "pm" to what the user typed, I get the 2115 error. I need to make this adjustment PRIOR to determining whether or not the subsequent text box contains a time value earlier than the prior text box.
I know I can accomplish all this with unbound text boxes, but that requires quite a bit of coding, and I feel there must be a better way. Does anyone know what it might be?
However, I also need to account for the fact that users may enter times either with or without an AM/PM indicator ("a", "am", "p" or "pm"). When the user does not specify such an indicator, Access assumes that the time is AM. So, if the previous text box contains 2:30 PM, and the user enters "3:00" in the subsequent text box, it is taken as 3:00 AM and the validation rule coded into the BeforeUpdate event procedure prevents the update. I've devised a means to determine whether AM or PM is appropriate (if the user does not specify), but when I attempt to use the BeforeUpdate event procedure to add "am" or "pm" to what the user typed, I get the 2115 error. I need to make this adjustment PRIOR to determining whether or not the subsequent text box contains a time value earlier than the prior text box.
I know I can accomplish all this with unbound text boxes, but that requires quite a bit of coding, and I feel there must be a better way. Does anyone know what it might be?