|
秒弑 发表于 2012-1-20 13:20
因为行情表是每天都有一张,如果每天导入一张新表,那么都要建立一张查询表,操作性会比较麻烦。
请教H版, ... - Private Sub Form_Load()
- Dim sSQL As String
- Dim dblSZ As Double
- Dim dblHS As Double
- Dim strTime As String
- Dim tbl As DAO.TableDef
- Dim qdf As DAO.QueryDef
- Set qdf = CurrentDb.QueryDefs("A")
- For Each tbl In CurrentDb.TableDefs
- If Left(tbl.Name, 2) = "行情" Then
- strTime = Right(tbl.Name, 8)
- If IsNull(DLookup("时间", "指数表", "时间='" & strTime & "'")) Then
- sSQL = _
- "SELECT 类别, 昨收, 最新, A股, (IIf(IsNull([最新]),[昨收],[最新]))*[A股]/333048.163 AS 深沪 FROM " _
- & tbl.Name
- qdf.SQL = sSQL
- dblSZ = Nz(DSum("深沪", "A", "类别 = 'SZ'"))
- dblHS = Nz(DSum("深沪", "A", "类别 = 'SH'"))
- sSQL = "insert into 指数表(时间,深主,沪市) values( '" & strTime & "'," & _
- dblSZ & "," & dblHS & ")"
- CurrentDb.Execute sSQL
- End If
- End If
- Next
- Me.ChildShow.Form.RecordSource = "指数表"
- qdf.Close
- Set qdf = Nothing
- End Sub
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|