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