ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] Excel VBA + Access ªº°ÝÃD¡K

[µo°Ý] Excel VBA + Access ªº°ÝÃD¡K

½Ð°Ý¡G
¤p§Ì±ý¨Ï¥ÎExcel VBA + Access¨Ó¼¶¼gµ{¦¡¡A©Ò¥H¶R¤F®Ñ¨Ó¬ã¨s¡A¦ý¬O¥O¤H®ð¾kªº¬O¡A
§Ú³s°õ¦æ®Ñ¤¤ªº½d¨Ò³£¥X°ÝÃD¡A®Ñ¤¤¬O¦³´£¨ì­Y¬O¦w¸ËOffice 64¦ì¤¸ªº(¦]¬°§Ú¬O¦w¸Ë
Office 2010 64¦ì¤¸ª©)¡A­n¥h¤U¸ü ¡uMicrosoft.Jet.OLEDB¡vªº64¦ì¤¸ª©¥»¦w¸Ë¡A§Ú
¤]¤U¸ü¤F¨Ã¦w¸Ë¤F(«ö§Ú¶i¤J³sµ²)¡A
¦ý¬O¡A°õ¦æ¸Óµ{¦¡¨ÌÂÂ¥X¿ù¡A¥H¤U¦C¥X¸Óµ{¦¡ªº¤@³¡¥÷(ªþ¥ó¬Oµ{¦¡ªº§¹¾ãª©)¡F¦w¸Ë¤W
­zMicrosoft.Jet.OLEDBªº64¦ì¤¸ª©«á¡A°õ¦æ¸Óµ{¦¡ªº¡i·s¼W°O¿ý¡j¡A´N¥X²{¤U¹Ï¿ù»~¡G
Err_01.jpg
¦Ó¬d¤F¤@¤Uºô¸ô¤W¤@¨Ç¸Ñ¨M¤èªk¡A±N
  1. .Provider = "Microsoft.Jet.OLEDB.4.0
½Æ»s¥N½X
§ï¦¨
  1. Provider = "Microsoft.ACE.OLEDB.12.0
½Æ»s¥N½X
«á¡A¤W­z¹Ï¤ùªº¿ù»~¬O¸Ñ¨M¤F¡A¦ý¬O
«o´«¦¨¥H¤Uªº¿ù»~°T®§¡G
Err_02.jpg
ºô¸ô¤W¡B½×¾Â¤W¤]§ä¤£¨ì¬ÛÃöªº¸Ñ¨M¤èªk¡A½Ð°Ý³o­Ó°ÝÃD­n¦p¦ó¸Ñ¨M©O?
ÁÂÁÂ!!

µù¡G
1¡Bªþ¥ó"CH21.rar"¬O¸Ó®Ñ©Òªþªº­ì©lµ{¦¡¡A§Ú¤@­Ó¦r³£¨S¦³§ï¹L¡C
2¡Bªþ¥ó"CH21_Modify.rar"¡A¬O§Ú±NOLEDB4.0§ï¦¨OLEDB.12.0ªºµ{¦¡½X¡C

CH21.rar (73.32 KB) (­ì©lµ{¦¡)
CH21_Modify.rar (87.79 KB) (¦Û¦æ§ï¹Lªºµ{¦¡½X)
  1. Sub AddTransfer(Style As Variant, FromStore As Variant, ToStore As Variant, Qty As Integer)
  2.     ' Page 21-6
  3.     Dim cnn As ADODB.Connection
  4.     Dim rst As ADODB.Recordset
  5.    
  6.     MyConn = ThisWorkbook.Path & Application.PathSeparator & "transfers.mdb"
  7.     MyConn = "Driver=Microsoft Access Driver (*.mdb);DBQ=" & MyConn
  8.     'MyConn = "Driver=Microsoft Access Driver (*.accdb);DBQ=D:\CH21\Transfers.accdb"
  9.    
  10.     ' ¶}±Ò³s½u
  11.     Set cnn = New ADODB.Connection
  12.     With cnn
  13.         .Provider = "Microsoft.ACE.OLEDB.12.0"
  14.         '.Provider = "Microsoft.Jet.OLEDB.4.0"
  15.         .Open MyConn
  16.     End With
  17.    
  18.     ' ©w¸q°O¿ý¶°
  19.     Set rst = New ADODB.Recordset
  20.     rst.CursorLocation = adUseServer
  21.    
  22.     ' ¶}±Ò¸ê®Æªí
  23.     rst.Open Source:="tblTransfer", ActiveConnection:=cnn, _
  24.                       CursorType:=adOpenDynamic, LockType:=adLockOptimistic, _
  25.                       Options:=adCmdTable
  26.    
  27.     ' ·s¼W¤@µ§°O¿ý
  28.     rst.AddNew
½Æ»s¥N½X

¦^´_ 1# darrenlien

ªþ¤W¤@­Ó¥i¥H¥Îªº½d¨Ò¡A¦Û¤v¸Õ¸Õ¬Ý


Chapter5.zip (237.75 KB)

TOP

¦^´_ 2# joey0415

­º¥ý¥ý·PÁ joeyj0415 ¤jªº¼ö¤ß¦^ÂСA¦ý¬O¤p§Ì¦]Åv­­ªºÃö«Y¡AµLªk¤U¸ü¸Óªþ¥ó¡A¯à¤£¯à¤W¶Ç¨ìÃþ¦ü¹³Megaªº§K¶OªÅ¶¡¡A
©Î¬O±zª½±µ¸ò§ÚÁ¿µ{¦¡½X­þÃä­n­×§ï´N¦æ¤F!!

ÁÂÁÂ!!

TOP

¤p§Ì¤]·Q¾Ç ¦p¦ó¥ÎAccess·í§@¸ê®Æ®w¡AExcel·í§@¿é¤J¤¶­±

²{¦b¥ÎExecl·í§@¸ê®Æ®w¦³®É­Ô¸ê®Æ¤Ó¦h®ÉŪ¨ú³£·|ÅܺC

TOP

¦^´_ 3# darrenlien

§Úªºdropbox

https://dl.dropboxusercontent.com/u/40393708/VBA/Chapter5.zip

TOP

¦^´_ 5# joey0415

¤Ó·PÁÂjoey0415¤j¤jªºÀ°¦£¡A§Ú¤w¤U¸ü¦¨¥\¡A·Ç³Æ¬ã¨s¤@¤U±zµ¹ªºµ{¦¡½X¡FÁÂÁÂ!!¦A¦¸·PÁÂ!!

TOP

        ÀR«ä¦Û¦b : ­ì½Ì§O¤H´N¬Oµ½«Ý¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD