从在线数据库自动下载数据 [英] Automatically downloading data from online database

查看:300
本文介绍了从在线数据库自动下载数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是不可能的,但我试图创建一个MS Access数据库,使用此链接中的表中的信息:

This might not be possible, but I am trying to create an MS Access database that uses information from the table in this link:

http://si3.bcentral.cl/Indicadoressiete/secure/Serie.aspx? G代码= PRE_TCO&放大器;参数= RABmAFYAWQB3AGYAaQBuAFMALQAkADYAbgBNAGgAaAAkADUAVwBQAC4AbQBYADAARwBOAGUAYwBjACMAQQBaAHAARgBhAGcAUABTAGUAdwA1ADQAMQA0AE0AawBLAF8AdQBDACQASABzAG0AXwA2AHQAawBvAFcAZwBKAEwAegBzAF8AbgBMAHIAYgBDAC4ARQA3AFUAVwB4AFIAWQBhAEEAOABkAHkAZwAxAEEARAA =

编辑:一个用户认为链接是可疑的。如果您不信任,请在Google上搜索智利中央银行统计数据库。然后,导航到观察美元系列。我包括了链接,使人们更容易。

one user thinks the link is suspicious. If you do not trust it, search Google for "Chile Central Bank Statistics Database". Then, navigate to the "observed dollar" series. I included the link to make it easier for people.

有人知道这是否可能吗?

Does anyone know whether this is possible? I am very new to this - ideally, I would like to do it in VBA.

非常感谢。

推荐答案

另一种方法是将网页原样下载到Daily Indicators.htm。

Another method is to download the page as is to "Daily Indicators.htm".

转到外部数据, HTML文档。

Go to External Data, More, HTML Document.

选择文件夹,选择文件,标记为创建链接...,单击确定。

Select Folder, select the file, mark Create a link ..., click OK.

标记:显示HTML表格,选择每日指标3,单击高级,将点设置为decimalseparator。单击确定,下一步。

Mark: Show HTML tables, select Daily Indicators3, click Advanced, set Dot as decimalseparator. Click OK, Next.

检查第一行包含列标题。点击下一步。

Check First row contains columnheads. Click Next.

将每列调整为货币,完成并保存。

Adjust each column to Currency, finish and save.

现在,表是要下载页面:

Now, all you need to update the table is to download the page:

Option Compare Database
Option Explicit

Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" ( _
    ByVal pCaller As Long, _
    ByVal szURL As String, _
    ByVal szFileName As String, _
    ByVal dwReserved As Long, _
    ByVal lpfnCB As Long) _
    As Long

Public Function DownloadFile( _
    ByVal strURL As String, _
    ByVal strLocalFilename As String) _
    As Long

' Download file or page with public access from the web.
' 2004-12-17. Cactus Data ApS, CPH.

' Usage, download a file:
' lngRet = DownloadFile("http://www.databaseadvisors.com/Graphics/conf2002/2002ConferencePicsbySmolin/images/dba02smolin27.jpg", "c:\happybassett.jpg")
'
' Usage, download a page:
' lngRet = DownloadFile("http://www.databaseadvisors.com/conf2002/conf200202.asp", "c:\dbaconference.htm")

' Returns 0 if success, error code if not.
' Error codes:
' -2146697210 "file not found".
' -2146697211 "domain not found".

' Limitation.
' Does not check if local file was created successfully.

    Dim lngRetVal As Long

    lngRetVal = URLDownloadToFile(0, strURL & vbNullChar, strLocalFilename & vbNullChar, 0, 0)

    DownloadFile = lngRetVal

End Function

这篇关于从在线数据库自动下载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆