Dear All,
I am trying to move to last row at form load .. but it doesnot work.. what I missed? I need advise
Thanks & Regards
Winanjaya
Private Sub Form_Load() CreateReportControl End Sub
Private Sub CreateReportControl() 'Start adding columns Dim Column As ReportColumn Set Column = wndReportControl.Columns.Add(COLUMN_SENT1, "Sent Date", 50, True) Set Column = wndReportControl.Columns.Add(COLUMN_SENT2, "Sent Time", 50, True) Set Column = wndReportControl.Columns.Add(COLUMN_FROM, "From", 180, True) Set Column = wndReportControl.Columns.Add(COLUMN_TO, "To", 180, True) Set Column = wndReportControl.Columns.Add(COLUMN_MSG, "Msg", 180, False)
wndReportControl.PaintManager.MaxPreviewLines = 1 PopulateSentItems wndReportControl.GroupsOrder.Add wndReportControl.Columns(0) wndReportControl.GroupsOrder(0).SortAscending = True wndReportControl.Columns(4).Visible = False Set fntStrike = wndReportControl.PaintManager.TextFont fntStrike.Strikethrough = True Set fntBold = wndReportControl.PaintManager.TextFont fntBold.Bold = True wndReportControl.Populate wndReportControl.SetCustomDraw xtpCustomBeforeDrawRow
wndReportControl.Rows.Row(wndReportControl.Rows.Count - 1).Selected = True
End Sub
Private Sub PopulateSentItems() Dim rsSentItems As New ADODB.Recordset Dim mSQL As String Dim mFrom As String, mTo As String, mUDate As String, mUTime As String, mMsg As String mSQL = "SELECT * FROM SMS WHERE STAT = '" & STAT & "' ORDER BY UDATE,UTIME" rsSentItems.Open mSQL, cnData, adOpenForwardOnly, adLockReadOnly If Not rsSentItems.EOF Then Do mFrom = rsSentItems!SENDER mTo = rsSentItems!dest mUDate = Format(rsSentItems!UDATE, "dd-mmm-yyyy") mUTime = Format(rsSentItems!UTIME, "hh:nn") mMsg = rsSentItems!MSG AddRecord mFrom, mTo, mUDate, mUTime, mMsg rsSentItems.MoveNext Loop Until rsSentItems.EOF End If errhand: rsSentItems.Close End Sub
Public Sub AddRecord(ByVal pFrom As String, ByVal pTo As String, ByVal pUDate, ByVal pUTime As String, ByVal pPreview As String) Dim Record As ReportRecord Set Record = wndReportControl.Records.Add() Dim Item As ReportRecordItem Set Item = Record.AddItem("") Record.AddItem pUDate Record.AddItem pUTime Record.AddItem pFrom Record.AddItem pTo Record.AddItem pPreview Record.PreviewText = pPreview End Sub
Private Sub wndReportControl_SelectionChanged() If Not wndReportControl.FocusedRow.GroupRow Then rtfText.Text = wndReportControl.FocusedRow.Record.PreviewText End If End Sub
|