Hello,
I am trying to build an aggregate function in VBA to be used in an Access query. Here is an example of the data that I want to query:
Field1 Field2
Test1 High
Test1 Medium
Test1 Low
Test2 Low
Test2 Medium
Here are the results I would like from my aggregate (Group By) query:
Field1 Field2
Test1 High
Test2 Medium
When I create a function, it is evaluated for every record. If someone could share the code behind Access's native "Sum" or "Count" functions, I could develop my code from that.
I realize that a way around this would be to assign a numberic value associated with each Field2 value and then take the MIN or MAX. But I would like to figure out how to create my own aggregate function. The VBA function would be a series of If statements to determine the appropriate value.
Thanks,
ejc
I am trying to build an aggregate function in VBA to be used in an Access query. Here is an example of the data that I want to query:
Field1 Field2
Test1 High
Test1 Medium
Test1 Low
Test2 Low
Test2 Medium
Here are the results I would like from my aggregate (Group By) query:
Field1 Field2
Test1 High
Test2 Medium
When I create a function, it is evaluated for every record. If someone could share the code behind Access's native "Sum" or "Count" functions, I could develop my code from that.
I realize that a way around this would be to assign a numberic value associated with each Field2 value and then take the MIN or MAX. But I would like to figure out how to create my own aggregate function. The VBA function would be a series of If statements to determine the appropriate value.
Thanks,
ejc