J
Jean
I have this code and currently it does it at one month at
a time. I now need it to look to see if the month and
year per 2 of the catagories match then subtract the Comm
amounts. Kind of like this
if mnth and year with the catagory of NonFocus =
mnth and year with catagory wild then (subtract the
COMM_AMT - wcamt) Right now it is only one month at a time
so it works. Any suggestions would be great. THANKS..
Dim sql
Dim rs As Recordset
Dim ter
Dim wcamt
Dim xsql
Dim xrs As Recordset
sql = "select * from tbl_comm_summary where CATEGORY
='Wildcard'"
Set rs = CurrentDb.OpenRecordset(sql)
Do Until rs.EOF
ter = rs!TERR
wcamt = rs!COMM_AMT
xsql = "select * from tbl_comm_summary
where CATEGORY='Non Focus Firm' and TERR='" & ter & "'"
Set xrs = CurrentDb.OpenRecordset(xsql)
xrs.Edit
xrs!COMM_AMT = xrs!COMM_AMT - wcamt
xrs.Update
xrs.Close
Set xrs = Nothing
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
a time. I now need it to look to see if the month and
year per 2 of the catagories match then subtract the Comm
amounts. Kind of like this
if mnth and year with the catagory of NonFocus =
mnth and year with catagory wild then (subtract the
COMM_AMT - wcamt) Right now it is only one month at a time
so it works. Any suggestions would be great. THANKS..
Dim sql
Dim rs As Recordset
Dim ter
Dim wcamt
Dim xsql
Dim xrs As Recordset
sql = "select * from tbl_comm_summary where CATEGORY
='Wildcard'"
Set rs = CurrentDb.OpenRecordset(sql)
Do Until rs.EOF
ter = rs!TERR
wcamt = rs!COMM_AMT
xsql = "select * from tbl_comm_summary
where CATEGORY='Non Focus Firm' and TERR='" & ter & "'"
Set xrs = CurrentDb.OpenRecordset(xsql)
xrs.Edit
xrs!COMM_AMT = xrs!COMM_AMT - wcamt
xrs.Update
xrs.Close
Set xrs = Nothing
rs.MoveNext
Loop
rs.Close
Set rs = Nothing