I have a text box thats getting just a bit more complex than I like:
This translates into:
The issue is I cant wrap my mind around all the fomatting, adding commas/and where needed and what not.
There MUST be a better way, or am I stuck doing this? I attempted VBA with the on load event but I keep getting errors from the below code so I got stuck.
It says it cant find the [QualificationID], I dont normally do VBA in my reports all that much so any help would be great!
Code:
="REMOVED classifies audit observations as Critical; Major; Minor; and Comment as defined below. The audit revealed " & _
IIf(fTableRecordCount("tblObservation","WHERE [fk_QualificationID]=" & [QualificationID] & "AND [fk_ObsClassification]=" & 1,False)=0,"",fTableRecordCount("tblObservation","WHERE [fk_QualificationID]=" & [QualificationID] & "AND [fk_ObsClassification]=" & 1,False) & " Critical, ") _
& IIf(fTableRecordCount("tblObservation","WHERE [fk_QualificationID]=" & [QualificationID] & "AND [fk_ObsClassification]=" & 2,False)=0,"",fTableRecordCount("tblObservation","WHERE [fk_QualificationID]=" & [QualificationID] & "AND [fk_ObsClassification]=" & 2,False) & " Major, ") _
& IIf(fTableRecordCount("tblObservation","WHERE [fk_QualificationID]=" & [QualificationID] & "AND [fk_ObsClassification]=" & 3,False)=0,"",fTableRecordCount("tblObservation","WHERE [fk_QualificationID]=" & [QualificationID] & "AND [fk_ObsClassification]=" & 3,False) & " Minor Observations and ") _
& IIf(fTableRecordCount("tblObservation","WHERE [fk_QualificationID]=" & [QualificationID] & "AND [fk_ObsClassification]=" & 4,False)=0,"",fTableRecordCount("tblObservation","WHERE [fk_QualificationID]=" & [QualificationID] & "AND [fk_ObsClassification]=" & 4,False) & " Comment(s)")_
& " which will require response from the " & [centerName] & " site within 14 days of receipt of this report."
This translates into:
Code:
[FONT=Calibri]REMOVED classifies audit observations as Critical; Major; Minor; and Comment as defined below. [/FONT]
[FONT=Calibri]The audit revealed [/FONT][B][U][COLOR=#4f81bd][FONT=Calibri]3 Minor[/FONT][/COLOR][/U][/B][FONT=Calibri] Observations which will require response from the [/FONT]
[B][U][COLOR=#4f81bd][FONT=Calibri]«centerName»[/FONT][/COLOR][/U][/B][FONT=Calibri] site within 14 days of receipt of this report. [/FONT]
The issue is I cant wrap my mind around all the fomatting, adding commas/and where needed and what not.
There MUST be a better way, or am I stuck doing this? I attempted VBA with the on load event but I keep getting errors from the below code so I got stuck.
strCritical = fTableRecordCount("tblObservation", "WHERE [fk_QualificationID]=" & [tblQualification.QualificationID] & "AND [fk_ObsClassification]=" & 1, False)
strMajor = fTableRecordCount("tblObservation", "WHERE [fk_QualificationID]=" & [QualificationID] & "AND [fk_ObsClassification]=" & 2, False)
strMinor = fTableRecordCount("tblObservation", "WHERE [fk_QualificationID]=" & [QualificationID] & "AND [fk_ObsClassification]=" & 3, False)
strComment = fTableRecordCount("tblObservation", "WHERE [fk_QualificationID]=" & [QualificationID] & "AND [fk_ObsClassification]=" & 4, False)
It says it cant find the [QualificationID], I dont normally do VBA in my reports all that much so any help would be great!