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

[µo°Ý] VBA ¥Îªí®æ¤º¬YÄæ¦ì¸ê®Æ¬d¸ßACCESS¸ê®Æ

[µo°Ý] VBA ¥Îªí®æ¤º¬YÄæ¦ì¸ê®Æ¬d¸ßACCESS¸ê®Æ

¤Wºôª¦¹L«Ü¦h¤å¦ý¬O³£¨S¿ìªk¦¨¥\
¥i¥H½Ð¦U¦ì¤j¤jÀ°­Ó¦£¶Ü
¬d¸ßµ²ªG¦s¤J¦P¦C¤§«á

PS¤@¶}©l´N¥d¦í¤F...«¬§O 'ADODB.Connection' ¥¼©w¸q¡C= =ºô¸ô¤W¼gªº¤u¨ã-¤Þ¥Î¤]¤£¦æ....

0116.rar (16.98 KB) ¦^´_ 11# alexliou

½Ð°Ý¤@¤U
¦pªG¥ó¸¹«á­±ÁÙ¦³ªF¦è
°²³]
00002E-A 1
00002E-A 2
¦pªþ¥ó
³o¨âµ§¤]­n¤@°_Åã¥Üªº¸Ü
§Ú­ì¥»³]©wªº»yªk
strSQL = "SELECT TOP 10 ¥ó¸¹, ³æ»ù, ¼t°Ó FROM ³æ»ù©ú²Ó WHERE ¥ó¸¹ = '00002E-A' "
½Ð°Ý­n«ç»ò§ï?

TOP

¦^´_ 11# alexliou


   ¤F¸Ñ¤F
·PÁÂalexliou¤j¤j

TOP

¥»©«³Ì«á¥Ñ alexliou ©ó 2012-5-12 06:29 ½s¿è
¦^´_  toxin alexliou µoªí©ó 2012-5-11 15:44

* ¥Nªí©Ò¦³ªºÄæ¦ì
§A¤w¸g¼g¤F­n¿ï¨ú­þ¨ÇÄæ¦ì  
©Ò¥H * ´N¤£»Ý­n¤F
­n§ï¦¨
SELECT  ¥ó¸¹ , ³æ»ù, ¼t°Ó FROM ³æ»ù©ú²Ó WHERE ¥ó¸¹  = '00002E-A'  ORDER BY 1 DESC
©Î¬O
SELECT * FROM ³æ»ù©ú²Ó WHERE ¥ó¸¹  = '00002E-A'  ORDER BY 1 DESC

PS.  ORDER BY 1 DESC ¦ü¥G¤]¤£»Ý­n
¦]¬°Where ±ø¥ó¤w«ü©w¥ó¸¹'00002E-A'
¬d¸ßµ²ªG¥u¦³¤@ºØ¥ó¸¹
´N¨S¦³±Æ§Çªº¥²­n¤F
Alex

TOP

¦^´_ 9# alexliou

·PÁÂalexliou¤j¤j¦^ÂÐ
»¡©úªº«Ü²M·¡...¦ý¬O¨Ì¸ê®Æ¿é¤J±¡ªp¨ÓÁ¿...¦n¹³¤£¤Ó¯à°÷¾a¨ä¥L±ø¥ó°µ±Æ§Ç§ä¨ì©Ò»Ý­nªº¸ê®Æ
©Ò¥H¥u¦n¥þ³¡³£¥ý¼g¥X¨Ó¤F....­n¾ainputbox¨Ó¨M©w­n¨º¤@µ§¸ê®Æ...
¤£¹L¸I¨ì¤@¥ó©Ç¨Æ...§âSelect  top 1§ï¦¨Select  *
´N·|¸I¨ì¿ù»~= =...©Ò¥H¼È®É¥ý¤USelect  top 100(¦]¬Y¨Ç¥ó¸¹©ú©ú¦³¦n´Xµ§¸ê®Æ«o¥u¥X²{¤@µ§)

TOP

¦^´_ 8# toxin
1. ¦b»POrder by¦X¥Î®É, TOP ­zµü¤£·|¦b¬Ûµ¥­È¤¤°µ¿ï¾Ü¡C
¦b±zªº¨Ò¤l¸Ì, ¦³¤Tµ§¸ê®Æªº¥ó¸¹¬°00002E-A
Top­zµü¨Ã«D®Ú¾Ú¸ê®Æ¦b¸ê®Æ®wªº¶¶§Ç¨Ó°Ï¤À½Ö¥ý½Ö«á,
¦Ó¬O¨Ì¾ÚOrder By Äæ¦ìªº­È¨Ó°Ï¤À
©Ò¥H¥¦µLªk°Ï¤À³o¤Tµ§ªº¥ý«á¶¶§Ç, ©Ò¥H¬d¸ß·|¶Ç¦^ 3 µ§°O¿ý

2. ¶Ç¦^ªºrecordset¤¤¦³¤Tµ§¬ö¿ý, ¦pªG­n°w¹ï­Ó§O¬ö¿ý°µ³B²z
¥i¥H§Q¥Î°j°é°t¦XrecordsetªºMovenext¤èªk»PEOFÄݩʨӳB²z

3.±z¤]¥i¥H§ïÅÜOrder byªºÄæ¦ì, ex .§ï¬° Order by ¼t°Ó
¦pªG¦P¤@¥ó¸¹¦P¤@¼t°Ó¥u¦³¤@µ§¬ö¿ý
¨º´N·|¥u¶Ç¦^¤@µ§¬ö¿ý
¦pªG¦P¤@¥ó¸¹¦P¤@¼t°ÓÁÙ¬O¦³¦hµ§¬ö¿ý
¦ý»ù®æ³£¤£¦P
´N¥i¥H¦A¼W¥[¤@­Óorder byÄæ¦ì
¦p Order by ¼t°Ó, ³æ»ù desc
Alex

TOP

¦^´_ 7# alexliou
·PÁÂalexliou¤j¤j
ÁÙ¬O¦³¥H¤U´X­Ó°ÝÃD
1.²z½×¤WÀ³¸Ó¬O¥u¦³¤@µ§¸ê®Æ¡A¦ý¬O¹ê»Ú¤W¥ó¸¹¬Û¦Pªº³£·|¥X²{= =
2.½Ð°Ý¤@¤U­n¦p¦ó¬d¸ß?³£¥¢±Ñ»¡= =
¦pªG¤è«Kªº¸Ü¥i¥HÀ°¤p§Ì¬Ý¤@¤UÀɮ׶Ü?
¦pªþ¥ó 0510.rar (16.88 KB)
¥ý¦b¦¹·PÁ¤j¤j

TOP

1. Access ªº½T¤ä´©SQL»yªk
SELECT TOP 1 ¥ó¸¹, ³æ»ù, ¼t°Ó FROM ³æ»ù©ú²Ó WHERE ¥ó¸¹  = '00002E-A'  ORDER BY 1 DESC
¬Ý°_¨Ó¨S¦³¿ù À³¸Ó­nÅã¥Ü²Ä¤@µ§¸ê®Æ

2. ¬d¸ß±ø¥ó'00002E-A'¥i¥H¥Îrange¤ºªº­È¥N´À
Alex

TOP

¦^´_ 5# alexliou
ok¤F
·PÁ¤j¤j
¥i¥H¥t¥~¸ß°Ý¤@¤U
­n¬d¸ß±Æ§Ç«á²Ä¤@µ§¸ê®Æ
ºô¸ô¤WÁ¿access¥i¥H¥Î¤@¯ësql«ü¥O
¦ý¬O¤U¤F
SELECT TOP 1 ¥ó¸¹, ³æ»ù, ¼t°Ó FROM ³æ»ù©ú²Ó WHERE ¥ó¸¹  = '00002E-A'  ORDER BY 1 DESC
¸ò
SELECT * ¥ó¸¹, ³æ»ù, ¼t°Ó FROM ³æ»ù©ú²Ó WHERE ¥ó¸¹  = '00002E-A'  ORDER BY 1 DESC
¤@¼Ë³£·|¥X²{3µ§±Æ§Ç¹Lªº¸ê®Æ= =

¥t¥~¬d¸ß±ø¥ó'00002E-A'¥i¥H¥Îrange¥N´À¶Ü?

TOP

¦^´_ 4# toxin
°²¦p§A¥Îªº¬OAccess ªºdatabae
connection string À³¸Ó¬O¥H¤Uªº«¬¦¡
"Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\databasename.mdb;Uid=yourid;Pwd=yourpassword"
©Î¬O
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\databasename.mdb;Jet OLEDB:Engine Type=5;Uid=yourid;Pwd=yourpassword"   ³o¼Ë¤]¦æ
Alex

TOP

        ÀR«ä¦Û¦b : µêªÅ¦³ºÉ¡D§ÚÄ@µL½a¡AµoÄ@®e©ö¦æÄ@Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD