- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
¥»©«³Ì«á¥Ñ singo1232001 ©ó 2023-7-20 22:26 ½s¿è
¦^´_ 1# wsx1130
Private Sub CommandButton1_Click()
Dim cn As Object
Set cn = CreateObject("ADODB.Connection")
cn.ConnectionString = Target
cn.Open
Dim strSQL As String
'strSQL = "SELECT DISTINCT ®Æ¸¹, ¤u¥O¼Æ¶q, ¾÷¾¹§Ç¸¹¶}©l,³Æµù FROM WORK43600 WHERE ¤u¥O='" & TextBox1.Value & "'"
strSQL = "SELECT DISTINCT * FROM WORK43600 WHERE ¤u¥O='" & TextBox1.Value & "'"
¥Ñ§Aªº»Ý¨D¬Ý¨Ó ·Pı¸ê®ÆÄæ¦ì«D±`¦h ´N³o¼Ë°µ¤§«á¦b½Õ¾ã´N¦n ¦h§ì¤@ÂI¨S®t ³t«×«Ü§Ö
Y¥¼¨Ó¯uªº¥u¦³¥Î³o¥|Äæ¸ê®Æ ®Æ¸¹, ¤u¥O¼Æ¶q, ¾÷¾¹§Ç¸¹¶}©l,³Æµù Y¯u´N¥u¦³³o¥|Ó ´N¥Î§A쥻´N¦n
Set rs = cn.execute(strSQL)
ar = rs.getrows
if isarray(ar) then
'µM«á§A¦b±qar°}¦C¸Ì±¤@µ§¤@µ§¹ïÀ³©ñ¨ìtextbox´N¦n
'¤£n¥Îrsªº¤è¦¡ª½±µ¤@µ§¤@µ§©ñ¨ì textbox ·|¥X²{²ö¦W¨ä§®ªº¿ù»~ ¤×¨ä¬O¤G¦¸©I¥s
'¦]¬°rsªº¸ê®Æ¬O¥Î"ª«¥ó«ü°w"ªº©Ò¥H§A·|¬Ý¨ì EOF ¥u¯à¨Ä¨Ä±qÀY¨ì§Àªº¶¶§Ç ¤@¦¸¨S°µ¦n¤Sn«¨Ó ¹ï©ó¤£¬O§¹¬ü®æ¦¡¸ê®Æ «Ü®e©ö»~§P
'¸ê®Æ¸g¹L¤@¦¸´N·|¥¢¥h«ü°w ³o¹ï©ó½s¼gÃö©óSQL©I¥s®Éªº¤H «D±`µhW ©Ò¥H¥ý«Øij¦s¨ì°}¦C «áÄò¦A³B²z
Else
MsgBox "§ä¤£¨ì¬ÛÀ³ªº¤u³æ¡I", vbExclamation, "¿ù»~"
End If
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub |
|