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, " _
As we are not familiar with your data architecture and we are not mind readers I'm afraid you will have to make your posts more informative.
Sorry about that.
Ok, I hope I can explain this, I have a form, that the person in charge of overtime uses, to keep track of personnels overtime.
When a person receives overtime, then the person in charge will enter the amount of overtime received into the form. Once the user clicks the "save" button, then I want the hours to be placed into 2 columns; 1 for the overtime hours the personnel just received and the other column for the running total of overtime hours.
The running total is needed to push the person with the most hours to the bottom of the overtime list.
I hope this helps to clear up what I am looking for.
The code in #1 post works fine and adds 99% of what I need, but I cannot figure out how add to the INSERT SQL above to total the hours and place it in the correct column.
Would I use something on the lines of : INSERT SUM(HoursWorked) FROM EVENT INTO ? WHERE FDID =
Last edited by cfd33; Apr 12th, 2010 at 04:30 PM.
Reason: adding more explaination
Would I use something on the lines of : INSERT SUM(HoursWorked) FROM EVENT INTO ? WHERE FDID =
That was what I was referring to... we are not familiar with architecture (relevant tables and how they are related, primary keys, etc) nor the data involved (what are the values of FDID? you didn't provide sample data).
Corollary, the issue you cited in post #1 is listview data related but you didn't provide existing query used to fill listview. How are we to improve something we don't understand (again, we don't know the query, tables, etc involved as we can't see what you see on your monitor)?
dee-u's post is the most informative answer you'll get based on what you provided.
The reason I am trying to save the running count is so that when the program is opened, the listview will populate with the running total. So, that way the users can see who is up next for the overtime.
So, you are saying that I should use a sql query to populate the listview for the total overtime hours?
strSQL + strSQL = "SELECT SUM (TotalHoursWorked) FROM Event
and how do I get the results into my last column (Total Hours Worked) ? as the other columns data is being pulled from the database, where the total hours worked, will not?
I get the error at the last column (which I have commented out). This is the column where the data from the Event table should be (the running total of hours).
Last edited by cfd33; Apr 20th, 2010 at 12:06 PM.
Reason: Added more information
I wouldn't worry about formatting the data or columns at this point.... just get the data loaded into the view first, make sure that that part is working.
Also... what IS "msfg1U"? Clearly a grid... but what kind of grid?
Is there a different way to load a flexgrid than what I am using?
With the code above, I get everything from the first table (1Unit) to load into the flexgrid, but not the running total data from the second table (Event).
I am not sure how to get the running total data from the Events table into the last column of the flexgrid.
After you open the recordset, try looping through the fields collection and print out the names of each field... make sure you are getting the fields you expect.
also break point at .Cols = rs1.Fields.Count - 1 and double check to make sure that rs1.fields.count does in fact equal 7.
I appreciate your help. I am not a programmer, just a borrower of code. I try to find what applies to my little projects and then mod them to my needs.
I am not sure how to loop through the field collections and print out the names.