Hi,
I have a combo box that opens reports but one of the reports originally had a click button that runs a somewhat complex code (that I did not write myself) to build the report. I'm beginning with VBA and having trouble writing that If/else code. Side question, what is the best way to learn Access VBA coding? I'm not finding books that seem to be recent. I'm learning trough fiddling with codes but lacking bases to better understand what I'm doing and debugging.
The original code is the quoted DoCmd.OpenReport line below and it works but what I am trying to write instead now is
"If report name (from the drop down) = "rptSonoco", then run the subroutine SonocoReport(), else run the OpenReport command"
Thank you
Code:
Private Sub cboReportsNames_AfterUpdate()'Open corresponding report from Report combo list once filtered by purchase category already
'DoCmd.OpenReport Me.cboReportsNames, acViewReport
IIf (Me.cboReportsNames "rptSonoco", SonocoReport, DoCmd.OpenReport Me.cboReportsNames, acViewReport)
End Sub
Thank you