Sports Clocking - Events Procedure Close - Few minor glitches

S

Sayth

I have been adding sports time/duration into my database based on a concept
by John W Vinson.

I have it working in the basic, with a few minor gotcha's. Essentially I
have 3 unbound boxes minutes, seconds & hundredths which the user is to input
the time into and the final time entered is to be displayed in a bound field.

Gotcha's
1) If user clicks into bound form field - Error occurs object doesn't
support this property or method - how can I add an on click event to tell
user to type values in boxes provided, instead of invoking the debugger.

2) Time displays in bound field as 62.3 for 1 minute 2 seconds and 30
hundredths which is correct as it is a Currency field General format in the
table can it display to a mm:ss:ms format in the form?

3) If I retype a time for a location and distance that already contains an
entry the form bound field shows the new value but the table value shows old
value. If it matters I want to stop the bound field showing time until all
boxes have been completed and if entry already exists to prompt the user to
accept change using code from here
http://msdn.microsoft.com/en-au/library/bb507728.aspx

This is the code that currently exists.

Private Sub Minutes_AfterUpdate()
Me!TimeDistance = CCur(Nz(Me!Minutes) * 60) _
+ CCur(Nz(Me!Seconds)) + CCur(Nz(Me!Hundredths) / 100)
End Sub

Private Sub Seconds_AfterUpdate()
Me!TimeDistance = CCur(Nz(Me!Minutes) * 60) _
+ CCur(Nz(Me!Seconds)) + CCur(Nz(Me!Hundredths) / 100)
End Sub

Private Sub Hundredths_AfterUpdate()
Me!TimeDistance = CCur(Nz(Me!Minutes) * 60) _
+ CCur(Nz(Me!Seconds)) + CCur(Nz(Me!Hundredths) / 100)
End Sub

Private Sub TimeDistance_Click()
If Not IsNull(Me!TimeDistance) Then
Me!Minutes = Me!Racetime \ 60 Mod 60
Me!Seconds = Me!Racetime - 60 * (Me!Racetime \ 60)
Me!Hundredths = Me!Racetime - 100 * (Me!Racetime \ 100)
End If
End Sub
 
J

John W. Vinson

I have been adding sports time/duration into my database based on a concept
by John W Vinson.

I have it working in the basic, with a few minor gotcha's. Essentially I
have 3 unbound boxes minutes, seconds & hundredths which the user is to input
the time into and the final time entered is to be displayed in a bound field.

Gotcha's
1) If user clicks into bound form field - Error occurs object doesn't
support this property or method - how can I add an on click event to tell
user to type values in boxes provided, instead of invoking the debugger.

Set the bound textbox's Enabled property to No, and its Locked property to
Yes. This will make it unclickable - the user will simply not be able to set
focus to it, or type into it, or do much of anything with it other than look
at it.
2) Time displays in bound field as 62.3 for 1 minute 2 seconds and 30
hundredths which is correct as it is a Currency field General format in the
table can it display to a mm:ss:ms format in the form?

Use *two separate controls*. You really want to store 62.3 in the table. You
might even want to set the bound control's Visible property to No (once you
have all the bugs out and don't need to see it), instead of making it disabled
and locked - the user can't type into it if they can't see it!

Put on another textbox (locked and disabled!) with a control source such as

[duration] \ 60 & ":" & Format([duration] - 60*([duration] \ 60), "00.00")

to display this as 1:02.30.
3) If I retype a time for a location and distance that already contains an
entry the form bound field shows the new value but the table value shows old
value. If it matters I want to stop the bound field showing time until all
boxes have been completed and if entry already exists to prompt the user to
accept change using code from here
http://msdn.microsoft.com/en-au/library/bb507728.aspx

Do the calculation and populate the duration textbox in the Click event of the
command button, and not in the AfterUpdate events of the textboxes.
 
S

Sayth

John W. Vinson said:
I have been adding sports time/duration into my database based on a concept
by John W Vinson.

I have it working in the basic, with a few minor gotcha's. Essentially I
have 3 unbound boxes minutes, seconds & hundredths which the user is to input
the time into and the final time entered is to be displayed in a bound field.

Gotcha's
1) If user clicks into bound form field - Error occurs object doesn't
support this property or method - how can I add an on click event to tell
user to type values in boxes provided, instead of invoking the debugger.

Set the bound textbox's Enabled property to No, and its Locked property to
Yes. This will make it unclickable - the user will simply not be able to set
focus to it, or type into it, or do much of anything with it other than look
at it.
2) Time displays in bound field as 62.3 for 1 minute 2 seconds and 30
hundredths which is correct as it is a Currency field General format in the
table can it display to a mm:ss:ms format in the form?

Use *two separate controls*. You really want to store 62.3 in the table. You
might even want to set the bound control's Visible property to No (once you
have all the bugs out and don't need to see it), instead of making it disabled
and locked - the user can't type into it if they can't see it!

Put on another textbox (locked and disabled!) with a control source such as

[duration] \ 60 & ":" & Format([duration] - 60*([duration] \ 60), "00.00")

to display this as 1:02.30.
3) If I retype a time for a location and distance that already contains an
entry the form bound field shows the new value but the table value shows old
value. If it matters I want to stop the bound field showing time until all
boxes have been completed and if entry already exists to prompt the user to
accept change using code from here
http://msdn.microsoft.com/en-au/library/bb507728.aspx

Do the calculation and populate the duration textbox in the Click event of the
command button, and not in the AfterUpdate events of the textboxes.
This is the code that currently exists.

Private Sub Minutes_AfterUpdate()
Me!TimeDistance = CCur(Nz(Me!Minutes) * 60) _
+ CCur(Nz(Me!Seconds)) + CCur(Nz(Me!Hundredths) / 100)
End Sub

Private Sub Seconds_AfterUpdate()
Me!TimeDistance = CCur(Nz(Me!Minutes) * 60) _
+ CCur(Nz(Me!Seconds)) + CCur(Nz(Me!Hundredths) / 100)
End Sub

Private Sub Hundredths_AfterUpdate()
Me!TimeDistance = CCur(Nz(Me!Minutes) * 60) _
+ CCur(Nz(Me!Seconds)) + CCur(Nz(Me!Hundredths) / 100)
End Sub

Private Sub TimeDistance_Click()
If Not IsNull(Me!TimeDistance) Then
Me!Minutes = Me!Racetime \ 60 Mod 60
Me!Seconds = Me!Racetime - 60 * (Me!Racetime \ 60)
Me!Hundredths = Me!Racetime - 100 * (Me!Racetime \ 100)
End If
End Sub
Thank You will have a look at this tonight after work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top