Originally Posted by
Jxsmith
...I want Access to do what I want it to do, not change our functioning method of doing things to suit the program...
As any experienced programmer will tell you, regardless of the language being used, you have to work within the rules and native abilities of that language, unless you're willing to do custom programming, if the language allows! Fortunately, Access does allow for custom programming, and I think the only practical way of doing this is to do your formatting using the Control's AfterUpdate event.
Something like this:
Code:
Private Sub TimeField_AfterUpdate()
Select Case Len(Me.TimeField)
Case 2
Me.TimeField = ":" & Right(Me.TimeField, 2)
Case 3
Me.TimeField = Left(Me.TimeField, 1) & ":" & Right(Me.TimeField, 2)
Case 4
Me.TimeField = Left(Me.TimeField, 2) & ":" & Right(Me.TimeField, 2)
End Select
End Sub
Note a couple of things about this approach:
The Field will need to be redefined as Text...you cannot enter a series of digits into a Field defined as Date/Time...Access won't allow it.
Because of this...in order to use the Field for calculations involving Time, you'll have to use Type Conversion, using CDate(Me.TimeField).
Originally Posted by
Jxsmith
...Surely someone has needed to input numbers like this before...
Actually, I've been answering questions on this, and half a dozen other Access forums, for a dozen years, now, and have never seen anyone presenting with this need! But to each their own!
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007