Using MS Access/Query


I have a table and i would like to compare 2 of my values. It is to do with booking time. The two columns are Starting Time and Ending time. I would like to make it so that you can't put in a value bellow the starting time and more than 3 hours after the ending time.

Well, a simple Validation Rule won't handle this. You would need a little bit of programming. In a form, you could set a BeforeUpdate event for your EndTime field and say something like:

If (EndTime < StartTime) or (EndTime > (StartTime + (3/24)) Then
MsgBox "Invalid End Time"
Cancel = 1
End If

Be sure to visit my web site and watch my FREE 2-hour-long Microsoft Access Video Tutorial

Richard Rost
599CD Computer Training

Using MS Access

All Answers

Answers by Expert:

Ask Experts


Richard Rost


I am happy to answer any kinds of questions about Microsoft Access - from basic table design to advanced VBA programming. Also, please feel free to check the Access Tips & Tricks section of my web site, and free Access 101 tutorial.


I am the president of and I specialize in Microsoft Access Tutorials. I have been teaching Access in the classroom since 1994, and online since 2002.

I am a self-taught Access expert. I have been building databases for clients since the early 90s. You can see a sample of my Access Tutorials on my web site at

©2016 All rights reserved.