I think @Edgar_ noticed that and got rid of the quotes in #2.
But to be honest, my question was more of why I can type the same syntax in property sheet, but not in VBA.
I was expecting to hear from @isladogs it's a bag or something, but it seems it's one of inconsistency between UI and VBA. (#8)
Actually I lied to you. You can write an expression in design view with single or double quotes and forcing the double quotes does not solve the problem. However the solution without quotes does work.
Public Function ResortFormNew(Mainfrm As String, SubfrmCtl As String)
Dim frm As Access.Form
Set frm = Forms(Mainfrm).Controls(SubfrmCtl).Form
debug.print frm.Name
'other code
End Function
Yes they are basically two versions of the same solution addressing the cause of the problem. They allow you to pas form reference from the expression assigned at runtime that does not include the " or '.
either
expression = "= ResortForm([Form])"
expression = "= ResortForm(Forms![FrmManu]![FrmManu_Sub].Form)"
passes a reference to the subform without " or '.
I am not sure why the syntax with ' or " does not work.