Textbox on Form

Zippyfrog

Registered User.
Local time
Today, 13:40
Joined
Jun 24, 2003
Messages
103
I have been working on this database of mine for quite some time, and I have run into a roadblock. Here is my situation. I currently have a form that has two texboxes, one that is linked to the field finaltimeminutes and one linked to the field finaltimeseconds. The user hits tab to jump between the two fields. So something that is 1 minute and 30 seconds has 1 in the first field, then a 30 in the second field. There is also a colon in a separate label, so to the end user the result on the screen looks like 1:30

What I would like to do is create an unbounded textbox where the user directly types in 1:30, and once the user exits the unbounded textbox, anything to the left of the colon goes into the finaltimeminutes field and whatever is after the colon goes into the finaltimeseconds field. How would I go about doing that? I have a feeling that I would use the event procedure "On Exit" for the unbounded textbox, but I don't know to take info before and after a predefined character, which in this case, is the colon.
 
This will probably get you there.

[abc] would be where the 1:30 or 16:45 etc is entered.

abcL: Left([abc],InStr([abc],":")-1)

abcR: Right(Trim([abc]),Len(Trim([abc]))-InStr(1,[abc],":"))

That paor would be creating new fields in a query.

If abcL and abcR were to be unbound text boxes then as their data source you enter

=Left([abc],InStr([abc],":")-1)

=Right(Trim([abc]),Len(Trim([abc]))-InStr(1,[abc],":"))

With somethig like this you probaly enter the 1:30 in a field and 1 and 30 would always be calculated via unbound text box or calculated query field.

But if you wanted to enter 1:30 in an unbound and the 1 and 30 go to fields then you would have the code for Field=Expression.
 
But if you wanted to enter 1:30 in an unbound and the 1 and 30 go to fields then you would have the code for Field=Expression.

That is what I am looking at accomplishing. If a user enters 1:30 into the unbound textbox, then I want it to automatically put the 1 in the "finaltimeminute" field and the 30 in the "finaltimeseconds" field of a table. So when I look at the record in the table, I see the 1 and 30 in the separate fields. I can't tell from the way you say it above is the way to accomplish that.
 
The two expressions I gave you extract anything to the left of : and anything to the right of :

me!finaltimeminute = Left([abc],InStr([abc],":")-1

me!finalsecond = Right(Trim([abc]),Len(Trim([abc]))-InStr(1,[abc],":"))
 

Users who are viewing this thread

Back
Top Bottom