Skip to content

Commit

Permalink
### Fixed
Browse files Browse the repository at this point in the history
- Catch errors in MeetManager export where no time was entered for event
- Correctly close Meet Manager export file handle if function crashes

### Changed
- Escape now closes Maintain Competitors Form
  • Loading branch information
ruddj committed Feb 27, 2019
1 parent 758f7a1 commit 047280d
Show file tree
Hide file tree
Showing 12 changed files with 123 additions and 97 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [5.2.2] - 2019-02-27
### Fixed
- Catch errors in MeetManager export where no time was entered for event
- Correctly close Meet Manager export file handle if function crashes

### Changed
- Escape now closes Maintain Competitors Form

## [5.2.1] - 2018-05-24
### Changed
- Reordered Ribbon to open on Entry Tab rather than Setup tab
Expand Down Expand Up @@ -221,7 +229,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Ordered Competitors handled differently: Table held locally. Does not delete old but overwrites them.


[Unreleased]: https://github.com/ruddj/SportsAdmin/compare/v5.2.1...HEAD
[Unreleased]: https://github.com/ruddj/SportsAdmin/compare/v5.2.2...HEAD
[5.2.2]: https://github.com/ruddj/SportsAdmin/compare/v5.2.1...v5.2.2
[5.2.1]: https://github.com/ruddj/SportsAdmin/compare/v5.2.0...v5.2.1
[5.2.0]: https://github.com/ruddj/SportsAdmin/compare/v5.1.4...v5.2.0
[5.1.4]: https://github.com/ruddj/SportsAdmin/compare/v5.1.3...v5.1.4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ For end users you can change the Sports.accdb file extension to .accdr to load i
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg

[download-badge]: https://img.shields.io/badge/download-latest-blue.svg
[version-badge]: https://img.shields.io/badge/version-5.2.1-blue.svg
[version-badge]: https://img.shields.io/badge/version-5.2.2-blue.svg
85 changes: 52 additions & 33 deletions Source/forms/CompetitorsSummary.bas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version =20
Version =21
VersionRequired =20
Begin Form
PopUp = NotDefault
Expand All @@ -14,10 +14,10 @@ Begin Form
GridY =20
Width =9648
ItemSuffix =19
Left =-18270
Left =5340
Top =2730
Right =-8625
Bottom =9510
Right =19230
Bottom =11880
HelpContextId =70
RecSrcDt = Begin
0xd614db87edc6e140
Expand All @@ -30,6 +30,7 @@ Begin Form
0x6801000068010000680100006801000000000000201c0000e010000001000000 ,
0x010000006801000000000000a10700000100000001000000
End
OnKeyDown ="[Event Procedure]"
OnResize ="[Event Procedure]"
OnLoad ="[Event Procedure]"
FilterOnLoad =0
Expand Down Expand Up @@ -578,6 +579,14 @@ Private Sub Form_Close()

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyEscape
DoEvents 'This fixes the known bug in Access 2007 that causes error 3059 to occur after ESC is pressed
DoCmd.Close ObjectType:=acForm, ObjectName:=Me.Name
End Select
End Sub

Private Sub Form_Load()

UpdateCompetitorsOrdered = False
Expand Down Expand Up @@ -704,37 +713,47 @@ End Sub
Private Sub Summary_KeyDown(KeyCode As Integer, Shift As Integer)
Dim lCurrentTime As Long, Cancel As Integer

If KeyCode = vbKeyDelete Then
DeleteBut_Click
Exit Sub
ElseIf KeyCode = vbKeyReturn Then
Summary_DblClick (Cancel)
Exit Sub
ElseIf KeyCode = vbKeyEscape Then
strSearch = ""
KeyCode = 0
ElseIf KeyCode = vbKeyBack Then
strSearch = Left(strSearch, Len(strSearch) - 1)
KeyCode = 0
ElseIf KeyCode = 0 Or KeyCode = vbKeyTab Or _
KeyCode < vbKey0 Or KeyCode > vbKeyDivide Then

Exit Sub
Else
' Check how old query is, if last letter older than x sec clear and start again
lCurrentTime = Timer
If (lCurrentTime - lLastSearch) <= 2 Then
strSearch = strSearch & Chr$(KeyCode)
Else
strSearch = Chr$(KeyCode)
End If
Select Case KeyCode
Case vbKeyDelete
DeleteBut_Click
Exit Sub
Case vbKeyReturn
Summary_DblClick (Cancel)
Exit Sub
Case vbKeyEscape
strSearch = ""
KeyCode = 0
' Using ESC to close form causes errors in form Close method call to update age.
DoEvents 'This fixes the known bug in Access 2007 that causes error 3059 to occur after ESC is pressed
DoCmd.Close ObjectType:=acForm, ObjectName:=Me.Name ' Close form
Case vbKeyBack
strSearch = Left(strSearch, Len(strSearch) - 1)
KeyCode = 0

Case 0, vbKeyTab, Is < vbKey0, Is > vbKeyDivide
' Non text key pressed
Exit Sub

Call ScrollSummary
Case Else
' Check how old query is, if last letter older than x sec clear and start again
lCurrentTime = Timer
If (lCurrentTime - lLastSearch) <= 2 Then
strSearch = strSearch & Chr$(KeyCode)
Else
strSearch = Chr$(KeyCode)
End If

Call ScrollSummary

lLastSearch = lCurrentTime
KeyCode = 0

lLastSearch = lCurrentTime
KeyCode = 0
End If

End Select


End Sub

Expand Down
10 changes: 5 additions & 5 deletions Source/forms/Enter Competitors Subform1.bas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version =20
Version =21
VersionRequired =20
Begin Form
NavigationButtons = NotDefault
Expand All @@ -9,10 +9,10 @@ Begin Form
GridY =20
Width =8991
ItemSuffix =71
Left =1650
Top =4125
Right =9300
Bottom =9270
Left =3495
Top =3195
Right =11145
Bottom =8340
HelpContextId =110
AfterDelConfirm ="[Event Procedure]"
OrderBy ="EnterCompetitorsSF.Place"
Expand Down
8 changes: 4 additions & 4 deletions Source/forms/MeetManagerDivisions.bas
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Begin Form
Width =3263
DatasheetFontHeight =11
ItemSuffix =73
Left =-11355
Top =4890
Right =-7830
Bottom =12645
Left =-19815
Top =3045
Right =-16290
Bottom =10800
HelpContextId =610
DatasheetGridlinesColor =14806254
RecSrcDt = Begin
Expand Down
24 changes: 19 additions & 5 deletions Source/forms/Utilities-Export.bas
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Begin Form
GridY =10
Width =5546
ItemSuffix =71
Left =-18000
Top =3795
Right =-12450
Bottom =8025
Left =-20400
Top =4320
Right =-11385
Bottom =8955
HelpContextId =565
RecSrcDt = Begin
0x6bd443042dc7e140
Expand Down Expand Up @@ -597,6 +597,9 @@ Public Function ExportMeetManager(sQuery As String, sFilePath As String)
Dim ff As Long
Dim nIndex As Integer
Dim sStr As String
Dim nErrors As Integer

nErrors = 0

Set Rs = CurrentDb.OpenRecordset(sQuery)

Expand All @@ -605,6 +608,13 @@ Public Function ExportMeetManager(sQuery As String, sFilePath As String)
Open sFilePath For Output As #ff

Do Until Rs.EOF
' Check Data is OK
If IsError(Rs(0)) Then
' Need to add some debugging to let user know about error.
nErrors = nErrors + 1
Rs.MoveNext
End If

'Queries are single column
sStr = Trim(Rs(0))

Expand All @@ -615,9 +625,13 @@ Public Function ExportMeetManager(sQuery As String, sFilePath As String)
sStr = ""
Rs.MoveNext
Loop
Close #ff

If nErrors > 0 Then
MsgBox ("While Export " & nErrors & " Errors were found")
End If

ExportMeetManager_Exit:
Close #ff
Rs.Close
Set Rs = Nothing
Exit Function
Expand Down
5 changes: 3 additions & 2 deletions Source/forms/Utilities.bas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version =20
Version =21
VersionRequired =20
Begin Form
AllowFilters = NotDefault
Expand Down Expand Up @@ -403,7 +403,8 @@ Begin Form
Height =885
Name ="Label71"
Caption ="This will clear all competitors from all existing events and recreate the heats "
"and finals as they are setup in the 'Quickly Setup Heats' form."
"and finals as they are setup in the 'Quickly Setup Heats' form.\015\012This will"
" also clear all event numbers."
End
Begin Rectangle
SpecialEffect =3
Expand Down
2 changes: 1 addition & 1 deletion Source/installs/Setup.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
!include "..\NsisMultiUser\Demos\Common\Utils.nsh"

!define PRODUCT_NAME "Sports Administrator" ; name of the application as displayed to the user
!define VERSION "5.2.1" ; main version of the application (may be 0.1, alpha, beta, etc.)
!define VERSION "5.2.2" ; main version of the application (may be 0.1, alpha, beta, etc.)
!define PROGEXE "Sports.accdr" ; main application filename
!define COMPANY_NAME "Sports Administrator" ; company, used for registry tree hierarchy
!define PRODUCT_FOLDER "SportsAdmin"
Expand Down
9 changes: 7 additions & 2 deletions Source/modules/VersionDetails.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ Option Compare Database
Option Explicit


Global Const VersionNumber = "5.2.1"
Global Const VersionDate = "(24/May/2018)"
Global Const VersionNumber = "5.2.2"
Global Const VersionDate = "(27/Feb/2019)"

' Version 5.2.2 - 2019-02-27
' Catch errors in MeetManager export where no time was entered for event
' Correctly close Meet Manager export file handle if function crashes
' Escape now closes Maintain Competitors Form

' Version 5.2.1 - 2018-05-24
' Reordered Ribbon to open on Entry Tab rather than Setup tab
Expand Down
20 changes: 10 additions & 10 deletions Source/queries/MeetManagerEvents.bas
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
dbMemo "SQL" ="SELECT \"D;\" & Competitors.Surname & \";\" & Competitors.Gname & \";;\" & Compe"
"titors.Sex & \";\" & Format(Competitors.DOB,\"mm/dd/yy\") & \";\" & DLookUp(\"[M"
"code]\",\"Miscellaneous\") & \";\" & DLookUp(\"[Mteam]\",\"Miscellaneous\") & \""
";;;\" & EventType.Mevent & \";\" & Replace(CompEvents.Result , \"'\",\":\") & \""
";M;\" & MeetManagerDivisions.Mdiv & \";\" AS EntryRecord\015\012FROM (EventType "
"RIGHT JOIN (Competitors LEFT JOIN (Events RIGHT JOIN CompEvents ON Events.E_Code"
" = CompEvents.E_Code) ON Competitors.PIN = CompEvents.PIN) ON EventType.ET_Code "
"= Events.ET_Code) LEFT JOIN MeetManagerDivisions ON Events.Age = MeetManagerDivi"
"sions.Eage\015\012WHERE (((Competitors.Gname)<>\"Team\") AND ((CompEvents.Place)"
"<=DLookUp(\"[Mtop]\",\"Miscellaneous\")) AND ((CompEvents.F_Lev)=0) AND ((EventT"
"ype.Include)=True) AND ((EventType.Flag)=True) AND ((Events.Include)=True) AND ("
"(EventType.Mevent)<>\"\"))\015\012ORDER BY Competitors.Age DESC , Competitors.Su"
"rname, Competitors.Gname;\015\012"
";;;\" & EventType.Mevent & \";\" & Replace(Nz(CompEvents.Result,\"\") , \"'\",\""
":\") & \";M;\" & MeetManagerDivisions.Mdiv & \";\" AS EntryRecord\015\012FROM (E"
"ventType RIGHT JOIN (Competitors LEFT JOIN (Events RIGHT JOIN CompEvents ON Even"
"ts.E_Code = CompEvents.E_Code) ON Competitors.PIN = CompEvents.PIN) ON EventType"
".ET_Code = Events.ET_Code) LEFT JOIN MeetManagerDivisions ON Events.Age = MeetMa"
"nagerDivisions.Eage\015\012WHERE (((Competitors.Gname)<>\"Team\") AND ((CompEven"
"ts.Place)<=DLookUp(\"[Mtop]\",\"Miscellaneous\")) AND ((CompEvents.F_Lev)=0) AND"
" ((EventType.Include)=True) AND ((EventType.Flag)=True) AND ((Events.Include)=Tr"
"ue) AND ((EventType.Mevent)<>\"\"))\015\012ORDER BY Competitors.Age DESC , Compe"
"titors.Surname, Competitors.Gname;\015\012"
dbMemo "Connect" =""
dbBoolean "ReturnsRecords" ="-1"
dbInteger "ODBCTimeout" ="0"
Expand Down
44 changes: 11 additions & 33 deletions Source/queries/MeetManagerEventsExp.bas
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
dbMemo "SQL" ="SELECT \"D\" AS RecType, Competitors.Surname, Competitors.Gname, Competitors.Sex"
", Format(Competitors.DOB,\"mm/dd/yy\"), DLookUp(\"[Mcode]\",\"Miscellaneous\"), "
"DLookUp(\"[Mteam]\",\"Miscellaneous\"), EventType.Mevent, Replace(CompEvents.Res"
"ult , \"'\",\":\") AS Result, CompEvents.nResult, MeetManagerDivisions.Mdiv\015\012"
"FROM (EventType RIGHT JOIN (Competitors LEFT JOIN (Events RIGHT JOIN CompEvents "
"ON Events.E_Code = CompEvents.E_Code) ON Competitors.PIN = CompEvents.PIN) ON Ev"
"entType.ET_Code = Events.ET_Code) LEFT JOIN MeetManagerDivisions ON Events.Age ="
" MeetManagerDivisions.Eage\015\012WHERE (((Competitors.Gname)<>\"Team\") AND ((C"
"ompEvents.Place)<=DLookUp(\"[Mtop]\",\"Miscellaneous\")) AND ((CompEvents.F_Lev)"
"=0) AND ((EventType.Include)=True) AND ((EventType.Flag)=True) AND ((Events.Incl"
"ude)=True) AND ((EventType.Mevent)<>\"\"))\015\012ORDER BY Competitors.Age DESC "
", Competitors.Surname, Competitors.Gname;\015\012"
", Format(Competitors.DOB,\"mm/dd/yy\") AS Expr1, DLookUp(\"[Mcode]\",\"Miscellan"
"eous\") AS Expr2, DLookUp(\"[Mteam]\",\"Miscellaneous\") AS Expr3, EventType.Mev"
"ent, Replace(Nz(CompEvents.Result,\"\"),\"'\",\":\") AS Result, CompEvents.nResu"
"lt, MeetManagerDivisions.Mdiv\015\012FROM EventType RIGHT JOIN (Competitors LEFT"
" JOIN ((Events RIGHT JOIN CompEvents ON Events.E_Code = CompEvents.E_Code) LEFT "
"JOIN MeetManagerDivisions ON Events.Age = MeetManagerDivisions.Eage) ON Competit"
"ors.PIN = CompEvents.PIN) ON EventType.ET_Code = Events.ET_Code\015\012WHERE ((("
"EventType.Mevent)<>\"\") AND ((Competitors.Gname)<>\"Team\") AND ((CompEvents.Pl"
"ace)<=DLookUp(\"[Mtop]\",\"Miscellaneous\")) AND ((CompEvents.F_Lev)=0) AND ((Ev"
"entType.Include)=True) AND ((EventType.Flag)=True) AND ((Events.Include)=True))\015"
"\012ORDER BY Competitors.Age DESC , Competitors.Surname, Competitors.Gname;\015\012"
dbMemo "Connect" =""
dbBoolean "ReturnsRecords" ="-1"
dbInteger "ODBCTimeout" ="0"
Expand All @@ -21,28 +21,10 @@ dbBoolean "FilterOnLoad" ="0"
dbBoolean "OrderByOnLoad" ="-1"
dbBoolean "TotalsRow" ="0"
Begin
Begin
dbText "Name" ="EntryRecord"
dbInteger "ColumnWidth" ="7035"
dbBoolean "ColumnHidden" ="0"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="Expr1006"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="Competitors.Surname"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="Expr1005"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="Expr1000"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="Competitors.Gname"
dbLong "AggregateType" ="-1"
Expand All @@ -51,10 +33,6 @@ Begin
dbText "Name" ="Competitors.Sex"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="Expr1004"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="EventType.Mevent"
dbLong "AggregateType" ="-1"
Expand Down
Binary file modified Sports.accdb
Binary file not shown.

0 comments on commit 047280d

Please sign in to comment.