A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Sports Clocking - Events Procedure Close - Few minor glitches



 
 
Thread Tools Display Modes
  #1  
Old March 21st, 2010, 01:59 PM posted to microsoft.public.access
Sayth
external usenet poster
 
Posts: 7
Default Sports Clocking - Events Procedure Close - Few minor glitches

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


  #2  
Old March 21st, 2010, 08:23 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Sports Clocking - Events Procedure Close - Few minor glitches

On Sun, 21 Mar 2010 06:59:01 -0700, Sayth
wrote:

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


--

John W. Vinson [MVP]
  #3  
Old March 21st, 2010, 09:34 PM posted to microsoft.public.access
Sayth
external usenet poster
 
Posts: 7
Default Sports Clocking - Events Procedure Close - Few minor glitches



"John W. Vinson" wrote:

On Sun, 21 Mar 2010 06:59:01 -0700, Sayth
wrote:

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


--

John W. Vinson [MVP]
.

Thank You will have a look at this tonight after work
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:35 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.