Although have never used ‘Fill Parameters’ event (and looking at currently), cannot comprehend why you need a parameter on a query to be used on a sub form. It seems this is better accomplished by using a table filter thus eliminating coding of any type. It is always preferable to avoid macros where possible.
For a table filter sample please see this post → Need to Filter a table with two fields for key words.
If this does not fit your needs, please further explain your process & reasoning (amend original question by editing).
Did about as much research on this as I care to. Frankly, I can’t see expending the time necessary for what is actually accomplished. There are multiple ways to do this easier: table filter (no macros); move info into filter using macro; run query from macro substituting the parameter in the macro. This last one can be done starting with:
oDatabaseFile = ThisComponent.Parent.CurrentController.DataSource
oQuery = oDatabaseFile.getQueryDefinitions()
stQuery = oQuery.getByName("MyQuery").Command
stQuery = Replace(stQuery, ":my_id","?")
then fill in the parameter ("?") and move the completed field into the form which would be set for SQL as Data source (not Query or Table). Have used this and filtering quite often.
But back to the original question. Using MRI & this post → See Parameters section Here, I found
addDatabaseParameterListener which with a couple of links brought me to → Parameters on the AOO wiki. There are a number of links to follow on the page & it also appears using Basic may be out of the question (you refer to Python anyway). But, again, after 30 or so more minutes I felt it was a lot more effort than it deserved. You’re welcome to follow it through.
Edit 2 on 2018-05-06:
The above edit would be to set your own event/listener.
OK. Really spent too much time on this (another couple of hours). There is a way to set the parameter but it seems to work erratically. First, the routine is called multiple times depending upon where it is called from (Opening form or new record selected). The method to set the parameter is found here → interface XParameters. With that, and the parameter based on a string, this is the routine used:
If oEvent.Source.Count = 0 Then Exit Sub
The problem was it only worked occasionally. No rhyme or reason. No changes made. Just would stop working & then very hard to get working again. Don’t know what triggers it.
Have now tried in Python and it seems to be working. Attached is a sample. The sample only displays Employees with a name of “Mary” in the sub form. Python macro is embedded in document. Did not want to create an elaborate test. This is left for you to accomplish.
Sample → SelectCompanyByFilter2.odb
Please mark your cross post accordingly.
If this answers your question please tick the (upper left area of answer). It helps others to know there was an accepted answer.