If txtyear1.Text <> "" And cbolocal.Text <> "" And cboprize.Text <> "" And DCname.Text <> "" Then '條件全都有填
s = "select * from prizetable"
 s = s & " where local = '" & cbolocal.Text & "'"
 s = s & " and prize = '" & cboprize.Text & "'"
 s = s & " and name = '" & DCname.Text & "'"
 s = s & " and ymd between #" & ymd1 & "#"
 s = s & " and #" & ymd2 & "#"
 
 Set rec = db.OpenRecordset(s)
 Set Data1.Recordset = rec
 Data1.Refresh
 
  If rec.NoMatch Then
   MsgBox "找不到對應的資料"
  End If
如果查詢不到資料就出現錯誤訊息...但程式都會跳過msgbox不執行,我語法有錯嗎...真是太奇怪了...麻煩大家幫我看一下...謝謝您們...
文章標籤
全站熱搜
創作者介紹
創作者 vbqa 的頭像
vbqa

小吳 VBQA 程式設計討論

vbqa 發表在 痞客邦 留言(1) 人氣(40)