How to pass multiple openargs

I have an Access form - sfrmANHC
I want to pass 2 openargs to the form, GrantExpenditures.  The 2 fields are grantid and agencyid.  Could someone help me with this?  
LVL 1
ksilvosoAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:

docmd.openform "GrantExpenditures", openargs:=me.grantid &";" & me.agencyid


now use the load event of form "GrantExpenditures" to get values

private sub form_load()
if len(me.openargs)> 0 then
      'pass the values accordingly
      me.grantid=split(me.openargs,";")(0)
      me.agencyid=split(me.openargs,";")(1)

end if

end sub



0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
You have to pass them both in one string, separated by commas (or whatever), and then in your form.Open event parse the OpenArgs string into it's separate pieces.

OpenArgs does not support an array of multiple values.
0
 
ksilvosoAuthor Commented:
Could you give me a code example?
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
I don't have it on me, so I'll step back to encourage other experts to respond.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.