Hello,

I'm a fairly experienced VB/VBA programmer, but a newbie
to VBScript. Currently, I'm converting existing Access
dbase forms into data access pages (DAP) for web access.
All existing VBA codes have to be converted to VBScript,
and I've encountered a problem with the DLookUp method.
I get the error: "Type mismatch: 'DLookup'"

This is the original code in the Access form

varPartName = RTrim(DLookup
("[PART_DESC]", "ICFPM", "[PART_ID]=txtPartID.Value"))
txtPartName.Value = varPartName

Quickly translated: Find the Part Description from table
ICFPM where the Part ID equals txtPartID.Value from the
form. Insert the value into txtPartName.

Is DLookup not supported in VBScript? If so, what can I
use instead? I'm using an unbound DAP form in Access.

Thanx,

Isbjornen.

Re: DLookup in VBScript by McKirahan

McKirahan
Tue Dec 23 18:51:01 CST 2003

"Isbjornen" <anonymous@discussions.microsoft.com> wrote in message
news:036201c3c9b1$467c2000$a401280a@phx.gbl...
> Hello,
>
> I'm a fairly experienced VB/VBA programmer, but a newbie
> to VBScript. Currently, I'm converting existing Access
> dbase forms into data access pages (DAP) for web access.
> All existing VBA codes have to be converted to VBScript,
> and I've encountered a problem with the DLookUp method.
> I get the error: "Type mismatch: 'DLookup'"
>
> This is the original code in the Access form
>
> varPartName = RTrim(DLookup
> ("[PART_DESC]", "ICFPM", "[PART_ID]=txtPartID.Value"))
> txtPartName.Value = varPartName
>
> Quickly translated: Find the Part Description from table
> ICFPM where the Part ID equals txtPartID.Value from the
> form. Insert the value into txtPartName.
>
> Is DLookup not supported in VBScript? If so, what can I
> use instead? I'm using an unbound DAP form in Access.
>
> Thanx,
>
> Isbjornen.


I haven't worked with DAP before but perhaps this will help; watch for
word-wrap.

Change "your-*" constants are needed.


WScript.Echo DLookup("your-partID")

Function DLookup(txtPartID)
DLookup = ""
'*
Const cMDB = "your-path/your-database.mdb"
Const cDSN = "DRIVER=Microsoft Access Driver (*.mdb);DBQ="
'*
Dim strSQL
strSQL = "SELECT PART_DESC FROM ICFPM"
strSQL = strSQL & " WHERE PART_ID = '" & txtPartID & "'"
'*
Dim objADO
Set objADO = CreateObject("ADODB.Connection")
objADO.Open cDSN & cMDB
Dim objRST
Set objRST = objADO.Execute(strSQL)
'*
If Not objRST.EOF Then
DLookup = objRST("PART_DESC")
End If
'*
Set objRST = Nothing
objADO.Close
Set objADO = Nothing
End Function



DLookup in VBScript by sachin

sachin
Wed Dec 24 01:33:41 CST 2003

Check this link---

http://support.microsoft.com/?kbid=234301


>-----Original Message-----
>Hello,
>
>I'm a fairly experienced VB/VBA programmer, but a newbie
>to VBScript. Currently, I'm converting existing Access
>dbase forms into data access pages (DAP) for web access.
>All existing VBA codes have to be converted to VBScript,
>and I've encountered a problem with the DLookUp method.
>I get the error: "Type mismatch: 'DLookup'"
>
>This is the original code in the Access form
>
>varPartName = RTrim(DLookup
>("[PART_DESC]", "ICFPM", "[PART_ID]=txtPartID.Value"))
>txtPartName.Value = varPartName
>
>Quickly translated: Find the Part Description from table
>ICFPM where the Part ID equals txtPartID.Value from the
>form. Insert the value into txtPartName.
>
>Is DLookup not supported in VBScript? If so, what can I
>use instead? I'm using an unbound DAP form in Access.
>
>Thanx,
>
>Isbjornen.
>
>.
>