Office中国论坛/Access中国论坛

标题: why it's pop error msg "Type mismatch"? [打印本页]

作者: dazzling    时间: 2006-5-27 01:05
标题: why it's pop error msg "Type mismatch"?
Sorry for no Chinese system of mine.

call it: ParamValue("WinZip_FOLDER")
Both of query "qry_ParameterGet" and table "z_Parameters" are exists.



source:
Public Property Get ParamValue(ByVal strItem As String) As String
    Dim objDB As Database
    Dim objQuery As QueryDef
    Dim objRecset As Recordset
    Dim sEnv As String
    Set objDB = CurrentDb
    Set objQuery = objDB.QueryDefs("qry_ParameterGet")
    objQuery.Parameters("[ParameterItem]").Value = strItem
    Set objRecset = objQuery.OpenRecordset 'wrong ! pop error msg "Type mismatch" ,why?!
    If Not (objRecset.BOF And objRecset.EOF) Then
        ParamValue = objRecset.Fields("Value").Value
        If UCase(Right(strItem, 6)) = "WRKDIR" Then
            ' Set the temp variable
            sEnv = Trim(Environ("TEMP"))
            If (sEnv = "") Then
                sEnv = ""
            End If
            ParamValue = sEnv & ParamValue
        End If
    Else
        ParamValue = ""
    End If
End Property

作者: sgrshh29    时间: 2006-5-27 14:22
没有看到文件,不知道具体是如何应用的.试试:

1.引用dao

2.这一句Dim objRecset As Recordset,改为Dim objRecset As dao.Recordset

不一定对.




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3