Skip to content

Commit

Permalink
Merge pull request #531 from woook/fix_date_issues
Browse files Browse the repository at this point in the history
Fix date issues in new array figures forms
  • Loading branch information
AmyAmelia authored Sep 6, 2018
2 parents 2fa5b5a + d6412f9 commit 0dd707d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion forms/987 ArrayAnalyses
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ Option Compare Database
Option Explicit

Private Function update_recordsource()
Dim start_date_formatted As String
Dim end_date_formatted As String
Dim sql_record_source As String

'Date must be formatted in US style for query
start_date_formatted = Format(Me.start_date, "mm/dd/yyyy")
end_date_formatted = Format(Me.end_date, "mm/dd/yyyy")

'SQL to pull out analysis counts for each analyst grouped by result code based on the referral type and date range entered in form
sql_record_source = "TRANSFORM Count(Checker.Initials) AS CountOfInitials " _
& "SELECT ResultCode_1.ResultCode " _
& "FROM ((((ArrayTest INNER JOIN Checker ON ArrayTest.Check1ID = Checker.Check1ID) INNER JOIN ResultCode ON ArrayTest.ArrayResultCodeID = ResultCode.ResultCodeID) INNER JOIN Patients ON ArrayTest.InternalPatientID = Patients.InternalPatientID) INNER JOIN ResultCode AS ResultCode_1 ON Patients.OverallResultCodeID = ResultCode_1.ResultCodeID) INNER JOIN Referral ON ArrayTest.ReferralID = Referral.ReferralID " _
& "WHERE (((Checker.Initials) Like 'APW' Or (Checker.Initials) Like 'MRC' Or (Checker.Initials) Like 'HT' Or (Checker.Initials) Like 'RP' Or (Checker.Initials) Like 'BW' Or (Checker.Initials) Like 'IN' Or (Checker.Initials) Like 'AFD' Or (Checker.Initials) Like 'SCH' Or (Checker.Initials) Like 'AC' Or (Checker.Initials) Like 'SB' Or (Checker.Initials) Like 'CVL') And ((arraytest.Service) = True) And ((Referral.ReferralID) = " & Me.referral_combo & ") And ((arraytest.ArrayResultDate) >= #" & Me.start_date & "#) And ((arraytest.ArrayResultDate) <= #" & Me.end_date & "#)) " _
& "WHERE (((Checker.Initials) Like 'APW' Or (Checker.Initials) Like 'MRC' Or (Checker.Initials) Like 'HT' Or (Checker.Initials) Like 'RP' Or (Checker.Initials) Like 'BW' Or (Checker.Initials) Like 'IN' Or (Checker.Initials) Like 'AFD' Or (Checker.Initials) Like 'SCH' Or (Checker.Initials) Like 'AC' Or (Checker.Initials) Like 'SB' Or (Checker.Initials) Like 'CVL') And ((arraytest.Service) = True) And ((Referral.ReferralID) = " & Me.referral_combo & ") And ((arraytest.ArrayResultDate) >= #" & start_date_formatted & "#) And ((arraytest.ArrayResultDate) <= #" & end_date_formatted & "#)) " _
& "GROUP BY ResultCode_1.ResultCode " _
& "PIVOT Checker.Initials;"

Expand Down
8 changes: 7 additions & 1 deletion forms/989 ArrayAnalysisChecks
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ Option Compare Database
Option Explicit

Private Function update_recordsource()
Dim start_date_formatted As String
Dim end_date_formatted As String
Dim sql_record_source As String

'Date must be formatted in US style for query
start_date_formatted = Format(Me.start_date, "mm/dd/yyyy")
end_date_formatted = Format(Me.end_date, "mm/dd/yyyy")

'SQL to pull out checking counts for each analyst grouped by result code based on the referral type and date range entered in form
sql_record_source = "TRANSFORM Count(Checker.Initials) AS CountOfInitials " _
& "SELECT ResultCode_1.ResultCode " _
& "FROM ((((ArrayTest INNER JOIN Checker ON ArrayTest.Check2ID = Checker.Check1ID) INNER JOIN ResultCode ON ArrayTest.ArrayResultCodeID = ResultCode.ResultCodeID) INNER JOIN Patients ON ArrayTest.InternalPatientID = Patients.InternalPatientID) INNER JOIN ResultCode AS ResultCode_1 ON Patients.OverallResultCodeID = ResultCode_1.ResultCodeID) INNER JOIN Referral ON ArrayTest.ReferralID = Referral.ReferralID " _
& "WHERE (((Checker.Initials) = 'AFD' Or (Checker.Initials) Like 'CVL' Or (Checker.Initials) Like 'AC' Or (Checker.Initials) Like 'SCH' Or (Checker.Initials) Like 'AFD' Or (Checker.Initials) Like 'SB' Or (Checker.Initials) Like 'CD') And ((arraytest.Service) = True) And ((Referral.ReferralID) = " & Me.referral_combo & ") And ((arraytest.ArrayResultDate) >= #" & Me.start_date & "#) And ((arraytest.ArrayResultDate) <= #" & Me.end_date & "#)) " _
& "WHERE (((Checker.Initials) Like 'AFD' Or (Checker.Initials) Like 'CVL' Or (Checker.Initials) Like 'AC' Or (Checker.Initials) Like 'SCH' Or (Checker.Initials) Like 'AFD' Or (Checker.Initials) Like 'SB' Or (Checker.Initials) Like 'CD') And ((arraytest.Service) = True) And ((Referral.ReferralID) = " & Me.referral_combo & ") And ((arraytest.ArrayResultDate) >= #" & start_date_formatted & "#) And ((arraytest.ArrayResultDate) <= #" & end_date_formatted & "#)) " _
& "GROUP BY ResultCode_1.ResultCode " _
& "PIVOT Checker.Initials;"

Expand Down

0 comments on commit 0dd707d

Please sign in to comment.