VBA OpenArgs for On Open (or On Load) Event for Report

TB11

Member
Local time
Yesterday, 23:47
Joined
Jul 7, 2020
Messages
84
Hi.

I am trying to pass the openargs to a report On Open (or on load event, I don't know which would be preferred). I have the code figured out (with prior help of Access World Forums) for the on click event of the form for openargs. Now, I've been trying to figure out the On Open/On Load code for the report so it opens to the openargs value (fk). I'm stuck.

The form is named Menu. The field on the form containing the report name is Test. The report is named r_Person. The field on the report that the openargs is to be passed to is fKPerson.

My code from On Click event from the Main form is:
If [fkFormReport] = 2 Then

DoCmd.OpenReport Me.Test, acViewReport, WhereCondition:="[fkPerson]=" & Me![fkPerson], OpenArgs:=Me.fkPerson

End If

Any help is appreciated.
 
It is going to do that with the Where condition surely?
What is the purpose of passing it in twice?
 
@Gasman dang you are right, I was doing that. I appreciate the help. Obviously, I should have stepped back before posting. Sorry about that.
 

Users who are viewing this thread

Back
Top Bottom