ACCESS Database Data Transmission Method

Source: Internet
Author: User
For a long time, the application data in the ACCESS database is transmitted between the company and the company, in EXCEL, DBASE, TXT, or even ACCESS format. I read a book recently and accidentally found a method. It seems much easier to use the ACCESS database to generate application data and read data.

For a long time, the application data in the ACCESS Data Warehouse is transmitted between the Branch and the company. It is not ideal to use EXCEL, DBASE, TXT, or even ACCESS. I recently read a book and accidentally found a method. It seems much easier to use the ACCESS data library to generate application data and read data.

ACCESS DataLibraryApplication in DataBetween the Branch and the company TransferIn EXCEL, DBASE, TXT, or ACCESS format, I don't think it is ideal. I recently read a book and accidentally found Method, Use ACCESS DataLibraryGenerate Declaration DataAnd read DataIt seems a lot easier. I 'd like to share it with you. At the same time, I hope to get more guidance.

Attached example:

Sub Mwrite ()

On Error GoTo thiserr

Dim rs As New ADODB. Recordset

Rs. Open "dlmd", CurrentProject. Connection, adOpenDynamic, adLockOptimistic, acTable

Rs. Save "a: \ dlmd. adtg", adPersistADTG

Rs. Close

Set rs = Nothing

Thisexit:

Exit Sub

Thiserr:

MsgBox Err. Description

Resume thisexit

End Sub

Sub Mread ()

On Error GoTo Merr

Dim I As Integer

Dim rsDe As New ADODB. Recordset

Dim rsSo As New ADODB. Recordset

RsSo. Open "a: \ dlmd. adtg", "provider = mspersist"

RsDe. Open "dlmd", CurrentProject. Connection, adOpenKeyset, adLockOptimistic, acTable

Do Until rsSo. EOF

RsDe. AddNew

For I = 0 To rsSo. Fields. Count-1

RsDe. Fields (I) = rsSo. Fields (rsDe. Fields (I). Name)

Next I

RsDe. Update

RsSo. MoveNext

Loop

RsSo. Close

RsDe. Close

Set rsSo = Nothing

Set rsDe = Nothing

Mexit:

Exit Sub

Merr:

MsgBox Err. Description

Resume Mexit

End Sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.