VBA Alternative to TransferDatabase for Importing
กระทู้เก่าบอร์ด อ.สุภาพ ไชยา

 342   1
URL.หัวข้อ / URL
VBA Alternative to TransferDatabase for Importing

มีคนถามไว้ที่  
http://www.utteraccess.com/forums/showflat.php?Cat=&Board=access_97&Number=107581&page=0&view=collapsed&sb=5&o=&fpart=1&vc=1&PHPSESSID=  
  
ดังนี้  
I can use this method:  
  
code:-------------------------------------------------------------------------------- 
    Set tblNewTable = dbCurrent.CreateTableDef(msTable) 
    With tblNewTable 
        .Connect = ";DATABASE=" & msExportPath & "\" & msTable & ".mdb" 
        .SourceTableName = strTableName 
    End With 
    dbCurrent.TableDefs.Append tblNewTable  
  
          --------------------------------------------------------------------------------  
  
as opposed to this  
  
code:-------------------------------------------------------------------------------- 
DoCmd.TransferDatabase acLink, "MicroSoft Access", _ ";DATABASE=" & msExportPath & "\" & msTable & ".mdb", acTable, strTable, strTable  
  
--------------------------------------------------------------------------------  
  
Is there an alternative method for IMPORTING rather than LINKING instead of  
using TransferDatabase?  
  
  
Thanks!  
  
สรุปคำถาม มีวิธีไหนที่จะนำข้อมูลของ Access เข้า Access ได้บ้าง นอกจากโค้ดข้างบน  
  
ผมแนะนำให้เขาใช้ RunCommand acCmdImport ดู ดังนี้  
  
Sub ImportMDB()  
'DoCmd.DoMenuItem acFormBar, acFile, 2, 0, acMenuVer70  
DoCmd.RunCommand acCmdImport  
End Sub  
  
ถ้าจะใช้ DoMenuItem ก็ได้ แต่ต้องระวังถ้าไม่มีเมนูมาตรฐานชื่อ acFormBar อยู่ ให้ใช้ RunCommand ดีกว่าครับ เพราะ Access จะให้ RunCommand มาแทน DoMenuItem   

*** Edited by Supap Chaiya *** 3/4/2546 12:29:21

1 Reply in this Topic. Dispaly 1 pages and you are on page number 1

1 @R06609
   
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.0500s