Article ID: 202144
Article Last Modified on 6/28/2004
First Label
InnerText: Address
First Textbox
ID: Address
Second Label
InnerText: CityStateZip
Second Textbox
ID: CityStateZip
<SCRIPT language=VBScript>
<!--
Sub AutoLookup
Dim x
x = MSODSC.DefaultRecordset.Fields.Item("CustomerID")
'Check to make sure the CustomerID field is not null.
If IsNull(x) = False Then
'Select all Customer records with matching
'CustomerID values and create a recordset
Dim rs
Dim conn
Dim sql
Set conn = MSODSC.Connection
Set rs = CreateObject("ADODB.recordset")
sql = "SELECT Customers.CustomerID, Customers.CompanyName, "
sql = sql & "Customers.Address, Customers.City, Customers.Region, "
sql = sql & "Customers.PostalCode "
sql = sql & "FROM Customers "
sql = sql & "WHERE (((Customers.CustomerID)='" & x & "'));"
'Open the recordset.
rs.Open sql,conn,3,3
'Set the Address1 and Address2 textboxes to the
'appropriate values for the current record.
Document.All.Item("Address").Value = rs("Address")
Document.All.Item("CityStateZip").Value = rs("City") & _
", " & rs("Region") & " " & rs("PostalCode")
'Close the current recordset.
rs.Close
Else
'Set the Address1 and Address2 textboxes to empty strings.
Document.All.Item("Address").Value = ""
Document.All.Item("CityStateZip").Value = ""
End If
End Sub
-->
</SCRIPT>
AutoLookup
Additional query words: prb auto look up not functioning working function doesn't row fixup fix-up
Keywords: kbdap kbprb KB202144