Function dlookup(strFieldName, strTableName, strWhere, objConn)
      '参考Access VBA 中的Dlookup函数
      '由于环境不同,加了ObjConn参数,直接将Adodb.connection直接调进来
      Dim strsql
      Dim rs
      Set rs = server.CreateObject("adodb.recordset")
      '下面要调用外部的一个自定义函数 checksql()
      strFieldName = checksql(strFieldName)
      If strWhere  "" Then
          strWhere = " where " & strWhere
      End If
      strsql="select "&strfieldname&" from "&strtablename&" " & strwhere
      'debugstop strsql
      O...[ 查看全文 ]