Public Function gb()
Dim dbf As FoxApplication
DoCmd.RunSQL "DELETE g.* FROM g;"
Dim r, l As String
Dim i As Long
For i = 1 To 6
Set dbf = New FoxApplication
With Application.FileDialog(1)
.Title = "Ïîèñê Ôàéëà"
.ButtonName = "Äîáàâèòü"
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "*.dbf", "*.dbf", 1
r = .Show
l = Trim(.SelectedItems.Item(1))
dbf.DoCmd ("USE " & l)
dbf.DoCmd ("COPY TO d:\1.xls TYPE XL5")
DoCmd.TransferSpreadsheet acImport, , i, "d:\1.xls", 1
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO g SELECT " & i & ".*FROM " & i & ";"
DoCmd.SetWarnings True
DoCmd.DeleteObject acTable, i
Kill ("d:\1.xls")
Set dbf = Nothing
End With
Next i
End Function
|