- ©«¤l
- 3
- ¥DÃD
- 3
- ºëµØ
- 0
- ¿n¤À
- 10
- ÂI¦W
- 0
- §@·~¨t²Î
- WINDOW 10
- ³nÅ骩¥»
- 22H2
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2023-8-3
- ³Ì«áµn¿ý
- 2023-10-26
|
[µo°Ý] §Ú¦³¤@ÓEXCEL ³sµ²¸ê®Æ®wªº°ÝÃDnµo°Ý
¥»©«³Ì«á¥Ñ cp914682 ©ó 2023-9-1 20:49 ½s¿è
§Ú¦A¥ÎEXCEL¬d¸ßACCESS¸Ì±ªº¸ê®Æ §Ún§ä¬Û¦üªº¸ê®Æ §Ú¦³¥Î¹L *¤]¥Î¹L% ¤U¥h´M§ä
¦ý¬O¤£ºÞ«ç»ò¬d³£¬OªÅ¥Õ,µM«á·Ó쥻ªºselect * from ¸ê®Æ where±ø¥ó like '" & Trim(UF1.TB2.Text) & "'") ³o¼Ë¬d±o¥X¨Ó
µ{¦¡½X¦p¤U
-------------------------------------------------------------------------------------------- ¤À³Î½u
Application.ScreenUpdating = False
Sheets("¸ê®Æ").Range("A2:CE" & r).ClearContents
UF1.LBox1.Clear
'«Å§iª«¥ó
Dim mycon As New ADODB.Connection
Dim myrs As New ADODB.Recordset
If UF1.TB2.Text = "" Then
mycon.Open "provider=microsoft.jet.oledb.4.0;" & "data source=" & ThisWorkbook.Path & "¸ê®Æ®w.mdb;"
Set myrs = mycon.Execute("select * from ¸ê®Æ where ±ø¥ó '%" & Trim(UF1.TB1.Text) & "%'")
Sheets("¸ê®Æ").Range("a2").CopyFromRecordset myrs
myrs.Close
mycon.Close
Set myrs = Nothing
Set mycon = Nothing
r=sheets("¸ê®Æ").range("b1").end (xldown).row
For I = 2 To r
If UF1.TB1.Text = Sheets("¸ê®Æ").Cells(I, 2) Then
UF1.LBox1.AddItem Trim(Sheets("¸ê®Æ").Cells(I, 2)) & " " & Trim(Sheets("¸ê®Æ").Cells(I, 3)) & " " & Format(Trim(Sheets("¸ê®Æ").Cells(I, 4)), "e/m/dD") & " " & Trim(Sheets("¸ê®Æ").Cells(I, 10)) & " " & Trim(Sheets("¸ê®Æ").Cells(I, 11))
End If
Next I
End If
If UF1.TB1.Text = "" Then
mycon.Open "provider=microsoft.jet.oledb.4.0;" & "data source=" & ThisWorkbook.Path & "\¡ÓÈû¥óªí.mdb;"
Set myrs = mycon.Execute("select * from ¸ê®Æ where±ø¥ó like '%" & Trim(UF1.TB2.Text) & "%'")
Sheets("¸¸ê®Æ").Range("a2").CopyFromRecordset myrs
myrs.Close
mycon.Close
Set myrs = Nothing
Set mycon = Nothing
r = Sheets("¸ê®Æ").Range("B1").End(xlDown).Row
For I = 2 To r
If UF1.TB2.Text = Sheets("¸ê®Æ").Cells(I, 10) Then
UF1.LBox1.AddItem Trim(Sheets("¸ê®Æ").Cells(I, 2)) & " " & Trim(Sheets("¸ê®Æ").Cells(I, 3)) & " " & Format(Trim(Sheets("¸ê®Æ").Cells(I, 4)), "e/m/dD") & " " & Trim(Sheets("¸ê®Æ").Cells(I, 10)) & " " & Trim(Sheets("¸ê®Æ").Cells(I, 11))
End If
Next I
End If
Application.ScreenUpdating = True |
|