Collect the most practical webpage special effect code!
Function DLOOKUP (StrfieldName, StrtAblename, Strwhere, Objconn)
'Reference DLOOKUP function in Access VBA
'Due to the different environment, the objconn parameters are added, and the adodb.connection is directly transferred in
dim strsql
DIM RS
set rs = server.createObject ("Adodb.oldSet")
'Let's call an external custom function checksql ()
Strfieldname = Checksql (StrfieldName)
if Strwhere <> "" THEN
Strwhere = "where" & strong
end if
Strsql = "select" & Strfieldname & "From" & Strtablename & "" & Strwhere
'Debugstop Strsql
On error resume next
RS.Oopen Strsql, Objconn, 1, 1
if err <> 0 THEN
response.write err.descripting
response.end ()
end if
if rs.eof and rs.bof then
dlookup = "" "
else
'To call a custom function NZ
'For details, please refer to the information of the Access VBA help
dlookup = nz (RS (RS (StrfieldName), "")
end if
RS.Close
end function