vba function parameters - can form object references be used?

I never see this done, but it seems to work ok.  Any reason why I shouldn't use form object references for parameters in a function?

Of the two statements below, are one better than the other?  If so, why?

Call runReport(2, Forms!frmGetPrinDueDate!cboAdmins, Forms!frmGetPrinDueDate!BDate, Forms!frmGetPrinDueDate!EDate)
-OR-
Call runReport(2, admin, beginDt, endD)

Thanks,
Lynn
LambelAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
No problem whatsoever. It's done all the time.

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Just a note.  If frmGetPrinDueDate is the form you are running this from, then you can do this:

Call runReport(2, Me.cboAdmins, Me.BDate, Me.EDate)

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"form object references for parameters "
But you are not really passing the Form Object ... you are passing actual values ... and I assume that is your intent ?

mx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Rey Obrero (Capricorn1)Commented:
if you are calling the function/sub runreport() from form "frmGetPrinDueDate"

this is enough

Call runReport(2, admin, beginDt, endD)

if you are calling the function/sub runreport() other that what was stated above you will need to specify where the source of the parameters are

Call runReport(2, Forms!frmGetPrinDueDate!cboAdmins, Forms!frmGetPrinDueDate!BDate, Forms!frmGetPrinDueDate!EDate)
0
Dale FyeOwner, Developing Solutions LLCCommented:
But you could also pass a reference to a form

Call RunReport(2, me)

Public Sub RunReport(SomeNumber as long, frm as Form)

    debug.print frm.cboAdmins, frm.BDate, frm.EDate

End Sub

0
LambelAuthor Commented:
DatabaseMX: Yes, that was my intent.  I guess I just never noticed it done this way.  thanks!
Lynn
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.