|
我写了一段程序,但是在调试过程中提示方法和数据成员未找到.
这段程序的用意是从窗体上的框里根据我输入的条件从数据库里查找适合条件的记录,代码如下
Private Sub 命令20_Click()
Dim val支行名称 As String
Dim val差错日期 As String
Dim val较严重性差错 As String
Dim val严重性差错 As String
Dim val一般性差错 As String
Dim val不规范 As String
Dim val查询 As String
If 支行名称.Value <> "< 哈哈 >" Then
val支行名称 = "='" & 支行名称.Value & "'"
Else
val支行名称 = "<>'I do not know!'"
End If
If 较严重性差错.Value <> "< 哈哈 >" Then
val较严重性差错 = "='" & 较严重性差错.Value & "'"
Else
val较严重性差错 = "<>'I do not know!'"
End If
If 严重性差错.Value <> "< 哈哈 >" Then
val严重性差错 = "='" & 严重性差错.Value & "'"
Else
val严重性差错 = "<>'I do not know!'"
End If
If 一般性差错.Value <> "< 哈哈 >" Then
val一般性差错 = "='" & 一般性差错.Value & "'"
Else
val一般性差错 = "<>'I do not know!'"
End If
If 不规范.Value <> "< 哈哈 >" Then
val不规范 = "='" & 不规范.Value & "'"
Else
val不规范 = "<>'I do not know!'"
End If
If 查询.Value <> "< 哈哈 >" Then
val查询 = "'" & 查询.Value & "'"
Else
val查询 = "''"
End If
If 差错日期.Value <> "< 哈哈 >" Then
val差错日期 = ">#" & Month(差错日期.Value) & "/" & Day(差错日期.Value) & "/" & Year(参加工作日.Value) & "#"
Else
val差错日期 = ">#1/1/1900#"
End If
'-----------------------------------------------------
Dim dbs As Database, strSQL1 As String, strSQL2 As String
Dim qdf1 As QueryDef
' Return reference to current database.返回参数到当前数据库
Set dbs = CurrentDb
strSQL1 = "SELECT 事后监督查询.* " & _
"FROM 事后监督查询 " & _
"WHERE (((事后监督查询.支行名称)" & val支行名称 & ") " & _
"AND ((事后监督查询.较严重性差错)" & val较严重性差错 & ") " & _
"AND ((事后监督查询.严重性差错)" & val严重性差错 & ") " & _
"AND ((事后监督查询.一般性差错)" & val一般性差错 & ") " & _
"AND ((事后监督查询.不规范)" & val不规范 & ") " & _
"AND ((事后监督查询.查询)" & val查询 & ") " & _
"AND ((事后监督查询.查询日期)" & val查询日期 & ") "
Set qdf1 = dbs.CreateQueryDef("查询2", strSQL1)
DoCmd.OpenQuery qdf1.Name
dbs.Close
Err_详细查找_Click:
MsgBox Err.Description
MsgBox "您的输入有错误,请重新核对输入的数据是否正确。"
Resume Exit_详细查找_Click
End Sub
结果一调试就出现方法和数据成员未找到(程序中红字部分),请各位老大给看一下,到底哪里出的问题,谢谢. |
|