|
-
Apr 11th, 2010, 08:22 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] How add a running total in a database
I hope the title is not too confusing. I did not know exactly how to word what I need.
In my program, when a person receives overtime, the number of hours is recorded and saved into the database. This part is fine.
So, for example, when John Doe works 6 hours of OT, then it is added to the database.
Now, when the person in charge of OT starts the program again, then John Doe should have 6 hours added to his total hours and it is displayed in the listview.
My problem is, is that I dont know how to do the second part.
Here is the code for adding the person info receiving OT hours:
vb Code:
Private Sub cmdSubmit_Click()
Dim strSQL As String
Dim blnTransOpen As Boolean
Dim ConnectionLiving As Boolean
'On Error GoTo ErrHandler
blnTransOpen = False
ConnectionLiving = False
Call openConn
ConnectionLiving = True
dbconn.BeginTrans
blnTransOpen = True
dbconn.Execute "INSERT INTO Event(FDID,Event_Name,Event_Hours,Time_Of_Event,Date_Of_Event,Time_Called, " _
& "Date_Called,HoursWorked,Left_Message) Values('" & txtFDID.Text & "', " _
& " '" & txtVenue.Text & "','" & txtHoursNeeded.Text & "','" & txtVenueTime.Text & "','" & txtVenueDate.Text & "', " _
& " '" & txtTimeCalled.Text & "','" & txtDate.Text & "','" & txtHoursWorked.Text & "','" & txtLeftMessage.Text & "')"
dbconn.CommitTrans
blnTransOpen = False
'DBCon.Close
ConnectionLiving = False
' Call ClearTB
End Sub
For example: lets say John Doe currently has worked 25 hours of OT and now he has worked 6 more hours.
So, now his total should be 31 hours. So, how is this entered into the database?
I hope I am making sense.
Last edited by cfd33; Apr 11th, 2010 at 10:58 PM.
Reason: Title not clear.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|