DEAR ALL ¤j¤j
1.¦p¹Ï¤@µ{¦¡
1.1»Ý¨D§ì¨ú2018/10/22 08:00:00 PM-2018/10/23 08:00:00 AM¤§¶¡ªº¼Æ¾Ú,
1.2¦ý¬O§ì¥X¨Óªº®É¶¡¤£·Ç½T???
1.3 RANGE("B1")=2018/10/22 08:00:00 PM RANGE("D1")=2018/10/23 08:00:00 AM
1.4½Ð±Ð¦ó³B¦³°ÝÃD? ·Ð¤£§[½ç±Ð THANKS*10000
¹Ï¤@
Sub VBA()
Range("A3:F65536").ClearContents
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strsql As String
cn.Open "Provider=MSDAORA.1;Password=SDTHH;User ID=URCE01B;Data Source=QSRS05A"
strsql = "SELECT TBDD7005.RECNO5,PN,LAYNM,PLOTER,NEDDP,TO_CHAR(FNTM,'YYYY/MM/DD HH:MM:SS AM/PM')" & Chr(13) & "" & Chr(10) _
& "FROM TBDD7005,TBDD7006" & Chr(13) & "" & Chr(10) _
& "Where TBDD7005.RECNO5=TBDD7006.RECNO5 AND TO_CHAR(FNTM,'YYYY/MM/DD HH:MM:SS AM/PM')>='" & Format(Range("B1"), "YYYY/MM/DD HH:MM:SS AM/PM") & "' AND TO_CHAR(FNTM,'YYYY/MM/DD HH:MM:SS AM/PM')<='" & Format(Range("D1"), "YYYY/MM/DD HH:MM:SS AM/PM") & "'"
' [H1] = strsql
rs.Open strsql, cn
On Error Resume Next
Range("A3").CopyFromRecordset rs
rs.Close
cn.Close
End Sub |