tailieunhanh - access 2007 vba bible phần 3

(TestFileExists) kiểm tra xem tập tin tồn tại trong một thư mục cụ thể:Công Sub ArchiveData (dteStart Như ngày, dteEnd Như ngày) Error GoTo ErrorHandler Dim appExcel Dim Dim Dim Như intReturn đã lngCount Integer Như n dài As Long | Working with Access Data 5 The code prints the search string always useful for debugging and the number of records in the recordset before and after adding the new record to the Immediate window Search string Category Firmware 29 records initially in recordset 30 records in recordset after adding Static The static cursor type DAO equivalent dbOpenSnapshot provides a static copy of a set of records for viewing or printing data. All types of movement through the recordset are allowed. Additions changes or deletions made by other users are not shown. For fast access to data that you don t need to modify where you don t need to view other users changes and you do need to be able to move both forward and backward in the recordset use a static cursor and the adLockReadOnly lock type as in the following TestStaticReadOnly procedure. If you do need to modify the data but don t need to see other users changes use the adLockOptimistic lock type instead the cursor type will change to keyset as noted previously . The TestStaticReadOnly procedure sets up a connection to the Northwind database opens a filtered recordset based on a table in the database and then iterates through the recordset printing information from its fields to the Immediate window. Note that once an ADO recordset has been created many of the same methods can be used to work with it as for a DAO database BOF EOF Find Move Private Sub TestStaticReadOnly On Error Resume Next Dim cnn As Dim rst As Dim strDBName As String Dim strDBNameAndPath As String Dim strConnectString As String Dim strSQL As String Dim strCurrentPath As String Dim fso As New Dim fil As Dim strPrompt As String Create a connection to an external database. strCurrentPath strDBName strDBNameAndPath strCurrentPath strDBName 125 Part II Writing VBA Code to Exchange Data between Office Components Attempt to find the database and

TỪ KHÓA LIÊN QUAN