this loop is not doing what i want

hi guys,
am doing a program that calculate the total loans collected by an individual per month. the loans are stored in a recordset (Access) and at the end of the month my program is meant to run through the recordset calculate total loan per staff using their Id's and month date. this loop only calculates for the first staff. what do i do. Help please

With rsloan 'recordset that opens the table

loanmonth = Format(Date, "mmm") 'todays month
'calculating total loan
Do While Not .EOF 'runs through recordset
txtIOU.Text = Nostaff
loanid = !StaffNo
loandate = !Tdate
txtIOU.Text = Nostaff
loandate = Format(loandate, "mmm")
loanAmount = !Amount
If (loanmonth = loandate) And (Nostaff = loanid) Then
loantotal = loantotal + loanAmount 'sums loan
txtLoan.Text = loantotal
End If

End With
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!