honey
honey

Reputation: 199

How to put Multiple checks in Expression Builder in a MS Access Form?

I am working on a macro in MS-Access which does some check on different Values in Form.

Here are the details of what i'm trying to do:

Form : Form is created based on a Table present in database and the structure of the same is like

    DataType CalcType Percent1 Percent2 Percent3 percent_check
    DT1      Avg      20       30       50       100 
    DT2      Mean     30       33       35       98
    DT3      Sum      10       35       57       102 

Column CalcType is a dropdown with three options. Each option would invoke different Macro written for it's calculation. I have added a separate Field percent_check to validate the sum of P1, P2 & P3.

Requirement: I want to write a condition that

    IF DataType is DT1 
     THEN IF percent_check<=100 
       THEN IF CalcType = "Avg" Invoke Avg_Macro 
         ELSE IF CalcType = "Mean" Invoke Mean_Macro
           ELSE Invoke Sum_Macro
     ELSE Message(Adjust the percent to make total as 100)

similarly for the rest of the data types.

I have written the cases in Expression Builder

    IF Form!DataType = DT1 THEN
      IF Form!percent_check <=100 THEN
        IF Form!CalcType = Avg THEN RunMacro - Avg_Macro
          ELSE IF Form!CalcType = Mean THEN RunMacro - Mean_Macro
        ELSE RunMacro - Sum_Macro
      ELSE MessageBox("Adjust percent to make total <=100)

But i am neither getting any results nor any error message.

Could anyone please help me in writing this expression for getting the required results.

Thanks!!

Upvotes: 0

Views: 231

Answers (1)

Rene
Rene

Reputation: 1093

Use VBA and rewrite the macro's into VBA too.

Upvotes: 0

Related Questions