作者: loreting 时间: 2007-12-4 16:24
Dim accessApp As Access.Application
Dim cPath As String
Dim sql_str As String
Dim sTable As String
cPath = CurrentProject.Path
If Right(cPath, 1) <> "\" Then cPath = cPath & "\"
sTable = "Dashboard.mdb"
Set tmpFSO = CreateObject("Scripting.FileSystemObject")
If tmpFSO.FileExists(cPath & sTable) Then
'tmpFSO.DeleteFile cPath & sTable
MsgBox sTable & " has exist"
Exit Sub
End If
Set tmpFSO = Nothing
Set accessApp = CreateObject("Access.Application")
accessApp.CreateNewWorkgroupFile (cPath & sTable)
sql_str = " select * into [" & cPath & sTable & "].T_summary from T_summary "
Call DoCmd.RunSQL(sql_str, True)