Dim Conn As New ADODB.Connection,RsMain As New ADODB.Recordset,MainSQL As String
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 then
MainSQL = "Select * from [SN$] in 'C:\产品SN.xls' 'Excel 8.0;' where [SN] = '" & Text1.text & "'"
----> [SN$], SN为Sheet名称
RsMain.open MainSQL ,Conn,1,1
If Not RsMain.EOF then
Text2.text = RsMain.fields("SN")
Label1.Caption = "合法条码"
ELSE
Text2.text = "没有找到"
Label1.Caption = "非法条码"
Endif
RsMain.close
Text1.Setfocus
Endif
[
本帖最后由 owenlu1981 于 2014-3-7 09:34 编辑 ]