Hi all,
This is my first post here, and I was unsure of whether to post in the database area or the general VB area as I am using DAO to connect to an Access Database (There was no sub board for that) but my question is regarding a calculation and control display that I am doing.
The application is a project tracker, and I am trying to calculate the total spend of the project and display it on either the first tab if it is an open project or the second tab if it is a completed project. For some reason, it is showing 0 for all but one of the projects. If anyones eyes can see the problem I would be really greatful. The code is below
[XCODE] Do While rs2.EOF <> True
If rs2.Fields(0).Value.ToString = pCdeLbl(i).Text.ToString Then
totalspend(i) = totalspend(i) + Int(rs2.Fields(2).Value)
rs2.MoveNext()
Else
rs2.MoveNext()
End If
i = i + 1
Loop
rs2.MoveFirst()
.MoveFirst()
i = 0
Do While .EOF <> True
If .Fields(0).Value.ToString = pCdeLbl(i).Text And .Fields(19).Value.ToString = "" Then
' Display the total spend for each project
ttlSpendLbl(i) = New Label
ttlSpendLbl(i).Text = totalspend(i).ToString
ttlSpendLbl(i).Location = New Point(getx(h), gety(v))
ttlSpendLbl(i).Size = New Size(50, 30)
v = v + 30
TabPage1.Controls.Add(ttlSpendLbl(i))
ttlSpendLbl(i).Visible = True
.MoveNext()
i = i + 1
Else
ttlSpendLbl(i) = New Label
ttlSpendLbl(i).Text = totalspend(i).ToString
ttlSpendLbl(i).Location = New Point(getx(h), gety(v2))
ttlSpendLbl(i).Size = New Size(50, 30)
v2 = v2 + 30
TabPage2.Controls.Add(ttlSpendLbl(i))
ttlSpendLbl(i).Visible = True
.MoveNext()
i = i + 1
End If
Loop
[/XCODE]
This is my first post here, and I was unsure of whether to post in the database area or the general VB area as I am using DAO to connect to an Access Database (There was no sub board for that) but my question is regarding a calculation and control display that I am doing.
The application is a project tracker, and I am trying to calculate the total spend of the project and display it on either the first tab if it is an open project or the second tab if it is a completed project. For some reason, it is showing 0 for all but one of the projects. If anyones eyes can see the problem I would be really greatful. The code is below
[XCODE] Do While rs2.EOF <> True
If rs2.Fields(0).Value.ToString = pCdeLbl(i).Text.ToString Then
totalspend(i) = totalspend(i) + Int(rs2.Fields(2).Value)
rs2.MoveNext()
Else
rs2.MoveNext()
End If
i = i + 1
Loop
rs2.MoveFirst()
.MoveFirst()
i = 0
Do While .EOF <> True
If .Fields(0).Value.ToString = pCdeLbl(i).Text And .Fields(19).Value.ToString = "" Then
' Display the total spend for each project
ttlSpendLbl(i) = New Label
ttlSpendLbl(i).Text = totalspend(i).ToString
ttlSpendLbl(i).Location = New Point(getx(h), gety(v))
ttlSpendLbl(i).Size = New Size(50, 30)
v = v + 30
TabPage1.Controls.Add(ttlSpendLbl(i))
ttlSpendLbl(i).Visible = True
.MoveNext()
i = i + 1
Else
ttlSpendLbl(i) = New Label
ttlSpendLbl(i).Text = totalspend(i).ToString
ttlSpendLbl(i).Location = New Point(getx(h), gety(v2))
ttlSpendLbl(i).Size = New Size(50, 30)
v2 = v2 + 30
TabPage2.Controls.Add(ttlSpendLbl(i))
ttlSpendLbl(i).Visible = True
.MoveNext()
i = i + 1
End If
Loop
[/XCODE]