IIf([Forms]![FrmSolfaDetail]![Che3].[OptionValue]=3;[TblSolfdetails].[payment];IIf([Forms…
- 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
- 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, andChe3on the formFrmSolfaDetail, and based on their values, it will return the appropriate result from the[TblSolfdetails].[payment]field.The revised code includes a nested
IIffunction for each checkbox to handle different conditions, and returns the corresponding value accordingly. The final result is labeled as[Result]. - 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
- 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, andChec3on the formFrmSolfaDetail, and based on their values, it will return the appropriate value.The revised code includes a nested
IIffunction for each checkbox to handle different conditions. IfChec3is True, it will return the value of[TblSolfdetails].[payment]. IfChec2is True, it will return -1. IfChec1is False, it will return 0. Otherwise, it will return Null. The final result is labeled as[Result].