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

[µo°Ý] VBA¨D±Ï°ª¤â¡A±N¸ê®Æ¤À³Î¨ì«ü©wTEXTBOX

[µo°Ý] VBA¨D±Ï°ª¤â¡A±N¸ê®Æ¤À³Î¨ì«ü©wTEXTBOX

§Ú¬O¥ÎVBA¡A·Q­n·s¼W¤@¨Ç¸ê®Æ¡A±qSQL SERVER¤¤Åª¨ú"³Æµù"ªº¸ê®Æ¡A³Æµùªº¸ê®Æ½d¨Ò¦p¤U

"7/3 USA
PO#22001999 - ®ü¹B
MFG Date¡G2023-03-15
Lancet¡G2201229001 2027-03-13
Code NO : F674
Control L1¡GXC230301L 2025-03-06*1507(QC*0)
Control L2¡GXC230302M 2025-03-05*1507(QC*0)
Control L3¡GXC230303H 2025-03-04*1507(QC*0)
Control L4¡GXC230323L 2025-03-22*1507(QC*0)
Control L5¡GXC2303012M 2025-03-23*1507(QC*0)
Control L6¡GXC23033232 2025-03-19*1507(QC*0)
MFG L1¡G2022-03-06
MFG L2¡G2022-03-07
MFG L3¡G2022-03-08
Strips¡GTHS2303002 2025-03-14
L1¡G46 - 76 mg/dL¡B34 - 78 mmol/L¡AMean: 61 mg/dL¡B62 mmol/L
L2¡G90 - 134 mg/dL¡B56 -90 mmol/L¡AMean: 112 mg/dL¡B63 mmol/L
L3¡G173 - 259 mg/dL¡B66 -778 mmol/L¡AMean: 216 mg/dL¡B64 mmol/L"

§Ú·Q­n±N¥H¤W"³Æµù"ªº¸ê®Æ¤À§O³£¦s¤JTEXTBOX¤¤
¹w´Áªºµ²ªG¦p¤U
TEXTBOX27=22001999
TEXTBOX23=2023-03-15
TEXTBOX24=2201229001
TEXTBOX25=2027-03-13
TEXTBOX26=F674
TEXTBOX4=XC230301L
TEXTBOX15=XC230302M
TEXTBOX16=XC230303H
TEXTBOX6=2025-03-06
TEXTBOX19=2025-03-05
TEXTBOX20=2025-03-04
TEXTBOX13=2022-03-06
TEXTBOX17=2022-03-07
TEXTBOX18=2022-03-08
TEXTBOX21=THS2303002
TEXTBOX22=2025-03-14
TEXTBOX28=46
TEXTBOX29=76
TEXTBOX30=34
TEXTBOX31=78
TEXTBOX32=61
TEXTBOX33=62
TEXTBOX34=90
TEXTBOX35=134
TEXTBOX36=56
TEXTBOX37=90
TEXTBOX38=112
TEXTBOX39=63
TEXTBOX40=173
TEXTBOX41=259
TEXTBOX42=66
TEXTBOX43=778
TEXTBOX44=216
TEXTBOX45=64
§ÚªºCODE¦p¤U¡A
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 & "'"
   
    Dim rs As Object
    Set rs = CreateObject("ADODB.Recordset")
    rs.Open strSQL, cn
   
    If Not rs.EOF Then
        TextBox2.Value = rs("®Æ¸¹").Value
        TextBox3.Value = rs("¤u¥O¼Æ¶q").Value
        TextBox5.Value = rs("¾÷¾¹§Ç¸¹¶}©l").Value
      
      Dim remark As String
        remark = rs("³Æµù").Value



     Else
        MsgBox "§ä¤£¨ì¬ÛÀ³ªº¤u³æ¡I", vbExclamation, "¿ù»~"
    End If
   
    rs.Close
    Set rs = Nothing
   
    cn.Close
    Set cn = Nothing
   
   
End Sub

§Ú¬O¥ÎVBA¡A·Q­n·s¼W¤@¨Ç¸ê®Æ¡A±qSQL SERVER¤¤Åª¨ú"³Æµù"ªº¸ê®Æ¡A³Æµùªº¸ê®Æ½d¨Ò¦p¤U

"7/3 USA
PO#2200 ...
wsx1130 µoªí©ó 2023-6-10 02:09


½Ð°Ý±z
textbox¡H¡H»P­ÈªºÃö«Y¬O«ç»ò¼Ë©w¸qªº¡H
¨Ò¦p
TEXTBOX27=22001999 ¬O²Ä¤Gµ§³Æµù PO#22001999 - ®ü¹B
¦ý¬O²Ä¤Tµ§³Æµù MFG Date¡G2023-03-15 ¶ñ¤JªºÄæ¦ì«o¬O TEXTBOX23=2023-03-15
³o¼Ë¬Ý¤£¤Ó¥X¨Ó³W«h¬O¤°»ò¡A¹ï©óµ{¦¡³]­p¦Ó¨¥¤ñ¸ûµLªk°µ¨ì¡A©Î¬O»Ý­n¹ï·Óªí¨Ó³B²z¡C

¦A¨ÓºI¨ú¨ìTextBox¤¤ªº¸ê®Æ¦ü¥G¤]¤£¬O¥þ³¡¸ê®Æ¦Ó¬O³¡¥÷¸ê®Æ¡A
¨Ò¦p¡G
TEXTBOX4=XC230301L ¨úªº¬O²Ä¤»­Ó³ÆµùControl L1¡GXC230301L 2025-03-06*1507(QC*0) ¤¤ªº³¡¥÷¤å¦r
¦ý¬O²Ä¤G­Ó³Æµù PO#22001999 - ®ü¹B ¨ú³¡¥÷­È¦s¨ì TEXTBOX27=22001999
³o¸Ì¤]¬O¬Ý¤£¤Ó¥X¨Ó¥¦ªº³W«h¬O¤°»ò¡A³o¼Ë·|§óÃø¥Îµ{¦¡³B²z¡C

¦³³W«h©Êªº¸Ü¦bµ{¦¡³¡¥÷´N¥i¥H¶i¦æ³B²z¡C

¥H¤W

TOP

¥»©«³Ì«á¥Ñ 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¤S­n­«¨Ó ¹ï©ó¤£¬O§¹¬ü®æ¦¡¸ê®Æ «Ü®e©ö»~§P
'¸ê®Æ¸g¹L¤@¦¸´N·|¥¢¥h«ü°w  ³o¹ï©ó½s¼gÃö©óSQL©I¥s®Éªº¤H «D±`µh­W ©Ò¥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

TOP

        ÀR«ä¦Û¦b : ¯u¥¿ªº·R¤ß¡A¬O·ÓÅU¦n¦Û¤vªº³oÁû¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD