There has to be an easier way to code this

Xx_TownDawg_xX

Registered User.
Local time
Yesterday, 19:31
Joined
Jan 16, 2009
Messages
78
This is really "ugly code" but it works.

Code:
AuditorType: IIf([tblDataEntry]![AuditorClock]="0000",[tblAuditors]![AuditorType],IIf([tblDataEntry]![OverRide]<>1,[tblOverRide]![SwapID],IIf([tblAuditors]![AuditorDept]<>[tblSeries]![Department_ID],"QA",[tblAuditors]![AuditorType])))
The problem is surely there is a better way to code what I want without it being so ugly. Essentially.. If the auditor works in the same department it is a "QC" audit, but if he/she is auditing another department it is a "QA" audit. However, we wanted the ability to "override" the logic to allow for "FC", "FG" and "RI" audits as well, but we also wanted the ability to show an "Int" audit if the auditor clock number is "0000".

HAS to be an easier way to code this.
 

Attachments

  • example.jpg
    example.jpg
    78.1 KB · Views: 178
Convert your IIFs to an IF..ELSE...END IF block and put it in a function. Ensure the function is in a Standard MODULE and that it's PUBLIC, then call the function by putting it in the Control Source of the Options Frame.

You would need to write it like this (e.g. the function is called getAuditorType):

=getAuditorType()
 

Users who are viewing this thread

Back
Top Bottom