Perhaps you can try to use PIModule.PIUnitBatchSearch() function to find the PIUnitBatches of the Unit? Given that you know the unit, we can get the PIModule (PIUnit) that represent the Unit, then call the function. If you look at the PI SDK programming reference (available in the Library section) and do a search on PIUnitBatchSearch, you should find the description on how to use this function and also an example (in VB) on it.
From the search result, you can link back to the PIBatch that the unitbatches are part of.
Thanks Han for your reply,
this worked to a certain extend. I am now indeed able to get the batches from a specific unit. I can't figure out however how to get a result for multiple units; we have multiple similar reactors running batches and I want to have an overview of the batches over all these reactors, but not from our mixers.
When I use the Module Database to search for unit batches I can enter Reactor* as a search option. However, this is not available within VBA.
I have found it
; it all had to do with the location within the Module Database I did the search. When selecting the root of the MDB I had more options then when selecting a unit. The solution was to use the moduleDB object instead of the module object. The PIUnitBatchSearch on a moduleDB object does have the option for a ModuleNameMask
Cool! Good that you found that.