Skip to content
The Chat Archive
gpt-3.5-turbo-0613· OpenAI WildChat-4.8M (AI2)

IIf([Forms]![FrmSolfaDetail]![Che3].[OptionValue]=3;[TblSolfdetails].[payment];IIf([Forms…

  1. User

    IIf([Forms]![FrmSolfaDetail]![Che3].[OptionValue]=3;[TblSolfdetails].[payment];IIf([Forms]![FrmSolfaDetail]![Che2].[OptionValue]=2;[TblSolfdetails].[payment]=True;IIf([Forms]![FrmSolfaDetail]![Che1].[OptionValue]=1;[TblSolfdetails].[payment]=False;Null))) correct this code to working in query access

  2. Assistant

    To correct the syntax and make this code work in a query in Access, you can use the following revised code:

    IIf([Forms]![FrmSolfaDetail]![Che3].[OptionValue] = 3, [TblSolfdetails].[payment],
        IIf([Forms]![FrmSolfaDetail]![Che2].[OptionValue] = 2, IIf([TblSolfdetails].[payment]=True,True,False),
            IIf([Forms]![FrmSolfaDetail]![Che1].[OptionValue] = 1, IIf([TblSolfdetails].[payment]=False,True,False), Null))) As [Result]
    

    This code will evaluate the value of the checkboxes Che1, Che2, and Che3 on the form FrmSolfaDetail, and based on their values, it will return the appropriate result from the [TblSolfdetails].[payment] field.

    The revised code includes a nested IIf function for each checkbox to handle different conditions, and returns the corresponding value accordingly. The final result is labeled as [Result].

  3. User

    IIf([Forms]![FrmSolfaDetail]![Chec3]=True;[TblSolfdetails].[payment];IIf([Forms]![FrmSolfaDetail]![Chec2]=True;[TblSolfdetails].[payment]=-1;IIf([Forms]![FrmSolfaDetail]![Chec1]=False;[TblSolfdetails].[payment]=0;Null))) correct this code

  4. Assistant

    To correct the syntax and make this code work in a query in Access, you can use the following revised code:

    IIf([Forms]![FrmSolfaDetail]![Chec3] = True, [TblSolfdetails].[payment],
        IIf([Forms]![FrmSolfaDetail]![Chec2] = True, -1,
            IIf([Forms]![FrmSolfaDetail]![Chec1] = False, 0, Null))) AS [Result]
    

    This code will evaluate the value of the checkboxes Chec1, Chec2, and Chec3 on the form FrmSolfaDetail, and based on their values, it will return the appropriate value.

    The revised code includes a nested IIf function for each checkbox to handle different conditions. If Chec3 is True, it will return the value of [TblSolfdetails].[payment]. If Chec2 is True, it will return -1. If Chec1 is False, it will return 0. Otherwise, it will return Null. The final result is labeled as [Result].