Dim Strc As String
If Trim(Text1.Text) <> "" Then
If cb1.Text = "編號" Then
Strc = "select * from dingdan where " & cb1.Text & "=" & Trim(Text1.Text)
Else
Strc = "select * from dingdan where " & cb1.Text & " like '%" & Trim(Text1.Text) & "%'"
End If
' MsgBox Strc
Call Conndata
Conn.Open
Adob.Open Strc, Conn, 1, 3
If Adob.EOF Then
MsgBox "沒有該條記錄!", 48 + vbOKOnly, "pcbsystem"
Else
Set fld4.DataSource = Adob
End If
Else
MsgBox "查詢資料不能為空", 48 + vbOKOnly, "pcbsystem"
End If
資料庫為ACCESS,其中欄位為客戶檔案名,客戶檔案名內有.,-,/這類符號
uj5u.com熱心網友回復:
這樣試試:If cb1.Text = "編號" Then
Strc = "select * from dingdan where " & cb1.Text & "='" & Trim(Text1.Text) &"'"
Else
Strc = "select * from dingdan where " & cb1.Text & " like '*" & Trim(Text1.Text) & "*'"
End If
uj5u.com熱心網友回復:
Strc = "select * from dingdan where " & cb1.Text & "=" & Trim(Text1.Text)Strc = "select * from dingdan where " & cb1.Text & " like '%" & Trim(Text1.Text) & "%'"
第二個查詢內容兩端加單引號, 第一個為何不加?
這代碼是拷貝來的吧?
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/122854.html
上一篇:關于類創建的一個問題
