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

[µo°Ý] Excel¤u§@ªí³æ»PAccess¸ê®Æ®wªºVBA¤¬°Ê°ÝÃD

¦^´_ 22# JEAN

TOP

¦^´_ 22# JEAN

TOP

¦^´_ 22# JEAN
¤@¡B ±N 2014¦~¾÷²¼°O¿ý.xls¡B¾÷²¼°O¿ý©ú²Óªí.mdb (§í©Î¬O ¾÷²¼°O¿ý©ú²ÓªíÀÉ®×.accdb)
     ¥þ³¡³£©ñ¸m©ó¦P¤@¥Ø¿ý¤U¡C ¨Ò¦p¡G §Ú¬°¤F¤è«K´ú¸Õ°_¨£¡A¦Ó±N¥¦­Ì¥þ¼Æ©ñ¦b¤@­Ó¦W¬°
     "2014¦~¾÷²¼°O¿ý" D ºÏºÐ¾÷ªº¦¸¥Ø¿ý¤U¡C
¤G¡B ¦pªG©p¨ººÝ¬O¶}±Ò Access MDF ªºÀÉ®× (Office 2003)¡A­þ»ò©p¥²¶·¥ý±N 21# ©Ò»¡ªº
     µ{¦¡½X (Else ³¡¤À) ¥ý¦æ­×¥¿¡C
     ¥Ø«e§Ú¬O¹w³]¶}±Òªº¬O Access ACCDB ªº¸ê®Æ®w¡A¦pªG­n¨Ï¥Î Access MDF ªºÀɮסA½Ð±N
     ACCDB ªº³¡¤À¤©¥H Mark °_¨Ó¡A¦Ó±N­ì¥» Mark ¤§ MDF ªº³¡¤À¥´¶} (²¾°£ Mark ' )¡A
     ¦p¦¹§Y¥i¨Ï¥Î MDF ªºÀɮפF¡C
     (¨âºØ¸ê®Æ®w§Ú³£¤@»ô©ñ¸m©ó D:\2014¦~¾÷²¼°O¿ý\ ¥Ø¿ý¤U¡A¥H¤è«K´ú¸Õ¤ÎÆ[¹î¸ê®ÆÅܤÆ)
¤T¡B ÂI¿ï¸Ó¦¸¥Ø¿ý D:\2014¦~¾÷²¼°O¿ý\2014¦~¾÷²¼°O¿ý.xls «K¥i°õ¦æ¡C

TOP

¦^´_ 21# c_c_lai


±z¦n:

§A°µªº¾÷²¼§@·~,°µªº«Ü¦n¡C ;P
¤£¹L§Ú¶}±Ò³£¤£¯à©l¥Î....

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-12-26 10:50 ½s¿è

¦^´_ 19# JEAN
¦Ü©ó "¾÷²¼§@·~"¸Ì­±ªºªí®æ³£¤£¯à¥Î
½Ð°Ñ¦Òªþ¥ó¡G
¾÷²¼°O¿ý©ú²Óªí.rar (11.43 KB)
¾÷²¼°O¿ý©ú²ÓªíÀÉ®×.rar (17.9 KB)
¦pªG©p¨ººÝ¬O¶}±Ò Access MDF ªºÀÉ®× (Office 2003) ¡G
  1. Sub OpenDB()
  2.     If ExcelData.Value = True Then    '  [data$]
  3.         Set cnn = CreateObject("ADODB.Connection")
  4.         Set rs = CreateObject("ADODB.Recordset")
  5.         Set cmd = CreateObject("ADODB.Command")
  6.     Else                              '  ¾÷²¼¬ö¿ý
  7.         Set cnn = New ADODB.Connection
  8.         Set rs = New ADODB.Recordset
  9.         Set cmd = New ADODB.Command
  10.     End If

  11.     With cnn
  12.         If .State = 1 Then .Close    '  adStateOpen
  13.         
  14.         If ExcelData.Value = True Then
  15.             .ConnectionString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" & _
  16.                                 ActiveWorkbook.Path & Application.PathSeparator & ActiveWorkbook.Name
  17.         Else
  18.             '  .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & _
  19.             '                    ThisWorkbook.Path & Application.PathSeparator & "¾÷²¼°O¿ý©ú²Óªí.mdb" & ";"
  20.             '  For Microsoft.ACE.OLEDB.12.0,you need Microsoft Office 12.0 Access Database Engine to be installed.
  21.             .ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;" & "Data Source=" & _
  22.                               ThisWorkbook.Path & Application.PathSeparator & "¾÷²¼°O¿ý©ú²ÓªíÀÉ®×.accdb" & ";"
  23.         End If
  24.         .Open
  25.     End With
  26. End Sub
½Æ»s¥N½X
«h±N¤W¦Cµ{¦¡½X¤§ Else ªº³¡¤À§ï¦¨¦p¤U¡G
  1.         Else
  2.            .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & _
  3.                              ThisWorkbook.Path & Application.PathSeparator & "¾÷²¼°O¿ý©ú²Óªí.mdb" & ";"
  4.              '  For Microsoft.ACE.OLEDB.12.0,you need Microsoft Office 12.0 Access Database Engine to be installed.
  5.             '   .ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;" & "Data Source=" & _
  6.             '                   ThisWorkbook.Path & Application.PathSeparator & "¾÷²¼°O¿ý©ú²ÓªíÀÉ®×.accdb" & ";"
  7.         End If
½Æ»s¥N½X
§Y¥i¡C
¦¹µ{¦¡½X¥i¥H³B²z MDF (For Excel 2003) ©ÎªÌ¬O ACCDB (For Excel 2007¡B2010) µ¥¸ê®Æ®w®æ¦¡¡C

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-12-26 10:53 ½s¿è

¦^´_ 19# JEAN
§Ú´N¬O¤@®É§Ñ¤F·íªì¬O½Ö´£°Ýªº¡A¹ê¦b
¤Ó¦n¤F¡I
·íªì©pªº´£°Ý¬O "¾÷²¼"¡A§Ú¬Ý¤F¤§«á«K
¸ÕµÛ±N¥¦§ï¦¨ ¤u§@ªí³æ¡B¥H¤Î Access ¸ê®Æ®w
³£¯à°õ¦æªº¤è¦¡ (¦P¨B¥Ü½d¦p¦ó§@·~)¡CÁ|¨Ò¨Ó»¡¡G
¦pªG³æ¯Â¦a¥u·Q¦b Excel °µ¿é¤Jµe­±¡AÀx¦s®É±N
¸ê®ÆÀx¦s¨ì  Access ¸ê®Æ®w¡A¨º»ò«K±N Excel "data" Àx¦s
¸ê®Æªº³¡¤À²¾°£¡A¥u«O¯dÀx¦s Access ¸ê®Æ®wªºµ{¦¡½X¡C
¤Ï¤§¡B¥çµM¡C©p¤@©w·|°Ý¬°¦ó¬Oºî¦Xªº¡A³o¯Âºé¬O¬°¤F
´ú¸Õ¡B¤ÎÁA¸Ñ¡A¦p¦ó¨Ï¥Î Excel À³¥Î ADO ³B²z¸ê®Æ°ÝÃD¡A
¥H¤Î¦p¦ó¦P®É³B²z Access ¸ê®Æ®wªºÅª¨ú¡B¬d¸ß¡B§R°£¡B¥H¤Î
¼g¤Jªº»yªkÀ³¥Î¦Ó°µ¥X¨Óªº½d¨Ò¡C©Ò¥H¤~±N©p·íªìªº´£°Ý
§¡¼g¦b "¾÷²¼§@·~" ¡B¥H¤Î "data" ¤º¤§¬G¡C¦p¦¹¡B¥ç¦^´_¤F
¤u§@ªí³æ "¾÷²¼" ªº³B¸Ì´£°Ý¡C³o»ò»¡©ú¬O§_¸Ñµª¤F©pªº°ÝÃD¡H

TOP

¥»©«³Ì«á¥Ñ JEAN ©ó 2013-12-26 09:51 ½s¿è

¦^´_ 1# c_c_lai


   ±z¦n:
³o­Ó2014¦~¾÷²¼°O¿ýÀɮ׬O§Ú°µªº,¸Ì­±¦h¤@­Ó"¾÷²¼§@·~"...³o­ÓªF¦è¦n¹³¦³¤@ÂI©Ç©Çªº
½Ð°Ý§A²{¦b¬O¼g¾÷²¼§@·~ªºVBAªºµ{¦¡,ÁÙ¬O¸Ì­±ªº"¾÷²¼"ªºVBAµ{¦¡¡C

§Ú¬Ý¤£À´¸Ì­±¦b¼g¤°»ò...¾÷²¼§@·~¸Ì­±ªºªí®æ³£¤£¯à¥Î

TOP

§Ú±N acdx ¤j¤j©ó 2013-12-11 16:52 ´£°Ýªº
"¦p¦óÅýComboBox¥i¥H¥Î·Æ¹«ºu°Ê?" ¸Ñ¨M¤è®×
¥[¥HÀ³¥Î¥[¤J¨ì "ñÃÒ¤º®e1"¡B"ñÃÒ¤º®e2"
¤º¡A¥i§@¬°½d¨Ò¤Þ¥Î¡A¦p©|¦³§ó¨Îªº³B²z¤èªk
©|½Ð¦U¦ì¤j¤j«ü±Ð¡I
2014¦~¾÷²¼°O¿ý.rar (84.95 KB)

TOP

¦^´_ 1# c_c_lai


    Æg
§A²q!!

TOP

¦^´_ 14# c_c_lai

ÁÂÁ§Aªº¸Ô²Ó»¡©ú

EXCEL Àɮרâ­Ó¤H¦P®É¶}±Ò´N·|¦³°ÝÃD¡A°£«D³]¬°¦@¥Î¼Ò¦¡¡A¦@¥Î¼Ò¦¡§Ú¸Õ¹L·|¶V¾Þ§@ÀÉ®×·|¶V¨Ó¶V¤j¾Þ§@¤]·|¶V¨Ó¶VºC¡A¥i¯à¬OEXCELª©¥»¤£¦P®Éªº°ÝÃD(ÁÙ¦b´ú¸Õ)

Á¿¨ì Clipper ¬O§Úªº³Ì·R¤]¬O³Ì«ë¡A¯u¬O©¹¨Æ¥u¯à¦^¨ý

¨ä¹ê¸ê®Æ®w³B²zÀ³¸Ó­n¨Ï¥ÎACCESS¨Ó³B²z¤ñEXCEL¦n¡A¥u¬O¤½¥q¤j³¡¤À¬O°µ¤uµ{­pºâ¤uµ{®v¥u·|¥ÎEXCEL¡AÁö¥Ø«e¤uµ{­pºâµ{¦¡¤]¤ä´©MDB¡A§ÚÁÙ¬O·Q¥ÑMDB±N¸ê®Æ·h¦ÜEXCEL¤j®a¤ñ¸û¦n¨Ï¥Î¡C
§Aªºµ{¦¡¥i¥HÅý§Ú¦n¦n¬ã¨s¤@¤U¡A¥i¯à»Ý­nªáÂI®É¶¡®ø¤Æ¡C

¨ä¹ê³o¨Ç¤£§Úªº¤u§@¤º®e¡A§Ú¥u¬O¦³¿³½ì¬ã¨sEXCEL¡A©Ò¥H¸}¨BºC¤@ÂI¡Aµ¥¹L¤@¨Ç®É¤é¦³°ÝÃD¦A¨Ó½Ð±Ð¡C
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

        ÀR«ä¦Û¦b : §g¤l¥ß«í§Ó¡A¤p¤H«í¥ß§Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD