I am making a database for real estate companies to keep track of their agents. Their commission rate is determined by the money value of their sales per year. The commision rate must autoupdate when they hit a certain point.
What I have done is create a crosstab query totaling their yearly sales (agents are the row, year is the column) and binded that to a subform in the agents form. What I would like is for possibly some VB code to look at the total in the subform for the current year and update the commission rate when it hits certain levels. I thought about doing this through an update query but there are some catches that make things more complicated. For one the rate resets to the lowest value at the beginning of a new year. Another is that if you hit a certain number in two consecutive years then you start the new year at a higher rate. For these reasons I think VB would be the way to go.
I'm not asking for the entire code to be written for me. I'm not a great programmer but I know the basics. If someone could just give me an example of how to write some vb code to update a form field based on a subform and how to deal with the date syntax in my examples then I think I can weed through the rest. Also if I'm going about this the wrong way then please speak up as well.
What I have done is create a crosstab query totaling their yearly sales (agents are the row, year is the column) and binded that to a subform in the agents form. What I would like is for possibly some VB code to look at the total in the subform for the current year and update the commission rate when it hits certain levels. I thought about doing this through an update query but there are some catches that make things more complicated. For one the rate resets to the lowest value at the beginning of a new year. Another is that if you hit a certain number in two consecutive years then you start the new year at a higher rate. For these reasons I think VB would be the way to go.
I'm not asking for the entire code to be written for me. I'm not a great programmer but I know the basics. If someone could just give me an example of how to write some vb code to update a form field based on a subform and how to deal with the date syntax in my examples then I think I can weed through the rest. Also if I'm going about this the wrong way then please speak up as well.