tailieunhanh - Access 2007 VBA Programmer’s Reference phần 3

Cửa sổ ngay lập tức cũng là một công cụ sửa lỗi mạnh mẽ cho các ứng dụng của bạn. Để biết thêm thông tin về cửa sổ trước mắt, xem Chương 8. Sử dụng cửa sổ ngay lập tức cùng với các khía cạnh khác của trình soạn thảo VBA chi tiết trong chương này | Chapter 6 Using DAO to Access Data Let s say that in the issue tracking example that you would like to see the data sorted in descending order. The following code uses the ColumnHistory method in Access to retrieve the values that were in the column and add them to a list box named IstHistory Private Sub ShowColumnHistory strTableName As String strFieldName As String History data is in this format Version Date Time History Data Const VERSION_PREFIX As String Version Dim strHistory As String Dim strHistoryItem As String Dim astrHistory As String Dim lngCounter As Long Dim datDate As Date Dim datTime As Date Dim strData As String Get the column history strHistory strTableName strFieldName Make sure there is history data If Len strHistory 0 Then Parse the column history into separate items. Each item in the history is separated by a vbCrLf but if there are carriage-returns in the memo field data you will get unexpected results. Split on the VERSION string in the history data. astrHistory Split strHistory VERSION_PREFIX Adding these lines ensures this code works regardless of how the control is configured on the form Value List 3 True Add column headings to the list box Date Time History Enumerate the history data in reverse to fill the list box in descending order For lngCounter UBound astrHistory To LBound astrHistory Step -1 Parse the history data strHistoryltem astrHistory lngCounter If Len strHistoryltem 0 Then Parse the date from the history data. This example parse the default US date format. datDate CDate Left strHistoryItem InStr strHistoryItem - 1 strHistoryltem Mid strHistoryItem InStr strHistoryItem 1 Parse the time from the history data datTime CDate Left strHistoryItem InStr strHistoryItem - 1 strHistoryltem Mid strHistoryItem InStr strHistoryItem 3 188 Chapter 6 Using DAO to Access Data Add the history item to the list box. .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.