To give you a little background, I am a VB6 programmer but have little experience with Microsoft Access. I have a VB6 program that does a little crunching of my database to return some info. For example, my database looks like this:
ID Action
0 state=0
1 alan
2 barry
3 state=1
4 alan
5 state=0
6 alan
7 state=1
8 alan
My program's crunching needs to count all of the iterations of "alan" when the state=0. That means in this sample that "alan" shows up twice when state is 0, not 4 times. I have not figured out a way to do this in my SQL statement, so if there is a way to do that, I'd love to hear it.
If there is not, I'd like to use some sort of stored procedure inside Access so I don't need to duplicate this code in every VB6 program I use. I toyed around with Access and was able to create a module and recreate this crunching in that module, but I can't figure out how to call that function from a VB6 application.
Can anyone please clear up how I can store this function in Access and use it from VB6, or better yet explain a way I can do this processing with pure SQL.
ID Action
0 state=0
1 alan
2 barry
3 state=1
4 alan
5 state=0
6 alan
7 state=1
8 alan
My program's crunching needs to count all of the iterations of "alan" when the state=0. That means in this sample that "alan" shows up twice when state is 0, not 4 times. I have not figured out a way to do this in my SQL statement, so if there is a way to do that, I'd love to hear it.
If there is not, I'd like to use some sort of stored procedure inside Access so I don't need to duplicate this code in every VB6 program I use. I toyed around with Access and was able to create a module and recreate this crunching in that module, but I can't figure out how to call that function from a VB6 application.
Can anyone please clear up how I can store this function in Access and use it from VB6, or better yet explain a way I can do this processing with pure SQL.