Thank you June7 even if you are the bearer of bad news...
I have another question though, and maybe this thread should be moved to the VBA Code forum:
The statement is issued after the user opens a form and checks each row they want to appear on the statement, in the Commission subform and/or the Expense subform.
Then they hit the Statement button that triggers the following code:
Code:
PrivateSub BtnReleve_Click()
DoCmd.RunSQL"UPDATE RqSelect_Dep SET RqSelect_Dep.DateDeduit =[Formulaires]![FmDate]![TxtDateRel], RqSelect_Dep.RefReleve =[Formulaires]![FmDate]![TxtNoRel] WHERE (((RqSelect_Dep.SelectDep)=Yes));"
DoCmd.RunSQL"UPDATE RqSelect_Com SET RqSelect_Com.DateReleve =[Formulaires]![FmDate]![TxtDateRel], RqSelect_Com.RefReleve =[Formulaires]![FmDate]![TxtNoRel] WHERE (((RqSelect_Com.SelectCom)=Yes));"
DoCmd.RunSQL"INSERT INTO TbReleve ( NoCourtier, DateRel, NoRel )SELECT[Formulaires]![FmDate]![TxtIDCourt] AS IDCourt, [Formulaires]![FmDate]![TxtDateRel]AS DateRel, [Formulaires]![FmDate]![TxtNoRel] AS NoRel;"
DoCmd.Close
End Sub
Is there a way to improve it and add something that could read: "If no row is checked in Commission subform, then add a dummy record for the same broker and with the same number in the Commission table, and if no row is checked in Expense subform, then add a dummy record for the same broker and with the same number to the Expense table".
My knowledge of VBA doesn't allow me to assess and type my "wish", so I'm just asking...
If it is too complicated, then I will go with the conditional display (and face the end users and their complaints).
Thank you again!