Yes, this is what I am using:
vb Code:
Set rs1 = New ADODB.Recordset rs1.CursorLocation = adUseClient strSQL = "SELECT * FROM 1Unit ORDER BY Hours ASC" rs1.Open strSQL, dbconn, adOpenDynamic, adLockOptimistic, adCmdText
So, should I use something like:
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?
Here is the code on load:
vb Code:
Set rs1 = New ADODB.Recordset rs1.CursorLocation = adUseClient strSQL = "SELECT * FROM 1Unit ORDER BY Hours ASC" rs1.Open strSQL, dbconn, adOpenDynamic, adLockOptimistic, adCmdText Screen.MousePointer = vbHourglass rs1.Requery If rs1.RecordCount = 0 Then msfg1U.Clear MsgBox "No record found" Screen.MousePointer = vbNormal Exit Sub ElseIf rs1.RecordCount >= 1 Then 'populate flexgrid box With msfg1U .Clear .TextMatrix(0, 0) = "FDID" .TextMatrix(0, 1) = "LAST NAME" .TextMatrix(0, 2) = "FIRST NAME" .TextMatrix(0, 3) = "MIDDLE INTIAL" .TextMatrix(0, 4) = "ASSIGNMENT" .TextMatrix(0, 5) = "KELLY DAY" .TextMatrix(0, 6) = "TOTAL HOURS WORKED" .Rows = rs1.RecordCount + 1 .Cols = rs1.Fields.Count - 1 .Row = 1 .Col = 0 .RowSel = .Rows - 1 .ColSel = .Cols - 1 .Clip = UCase(rs1.GetString(adClipString, -1, Chr(9), Chr(13), vbNullString)) .Row = 1 .ColWidth(0) = 1200 .ColWidth(1) = 2000 .ColWidth(2) = 2000 .ColWidth(3) = 2000 .ColWidth(4) = 2000 .ColWidth(5) = 2000 .ColWidth(6) = 2300 .ColAlignment(6) = flexAlignCenterCenter End With End If Screen.MousePointer = vbNormal




Reply With Quote