Microsoft Knowledge Base Email Alertz

KBAlertz.com: This article shows you how to find a record in a data access page based on an entry that you select from a drop-down list.

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com

ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 285353 - Last Review: January 29, 2007 - Revision: 5.4

How to find a record from a drop-down list in a data access page

This article was previously published under Q285353
Moderate: Requires basic macro, coding, and interoperability skills.

For a Microsoft Access 2000 version of this article, see 247823  (http://kbalertz.com/Feedback.aspx?kbNumber=247823/EN-US/ ) .

SUMMARY

This article shows you how to find a record in a data access page based on an entry that you select from a drop-down list.

MORE INFORMATION

To create the data access page and the appropriate script to find a selected record, follow these steps:
  1. Open the sample database Northwind.mdb.
  2. In the Database window, click Pages under Objects, and then double-click Create data access page by using wizard.
  3. Under Tables/Queries, click the arrow, and then click Table: Customers in the list.
  4. Click the >> button to move all the fields from the Available Fields list to the Selected Fields list, and then click Finish.
  5. If the toolbox is not displayed, click Toolbox on the View menu.
  6. In the toolbox, click Dropdown List, and then click anywhere on the page to add the dropdown list control.
  7. Set the following properties for the dropdown list control:
    ID: CustID
    ListRowSource: Table: Customers
    ListBoundField: CustomerID
  8. Right-click anywhere on the page, and then click Microsoft Script Editor on the shortcut menu to open the HTML source.
  9. In the Client Objects & Events dropdown list, click CustID, and then click onchange in the Events dropdown list.
  10. Type or paste the following script:
    <SCRIPT LANGUAGE=vbscript FOR=CustID EVENT=onchange>
    <!--
        Dim rs
        Set rs = MSODSC.DefaultRecordset
        rs.Find "[CustomerID] = '" & document.all.item("CustID").value & "'", 0, 1, 1
    
        '0 = Skip zero records before starting the search.
        '1 = Search in a forward direction.
        '1 = Always begin the search with the first record in the recordset. 
    -->
    </SCRIPT>
    					
    Note To search for numeric data, change the command line in the script as follows:
          rs.Find "[CustomerID] = " & document.all.item("CustID").value
    					
  11. Save the page as Page1.htm, and then click Page View on the View menu.
  12. Click a value in the CustID drop-down list to move the data access page to that record.

APPLIES TO
  • Microsoft Office Access 2003
  • Microsoft Access 2002 Standard Edition
Keywords: 
kbscript kbprogramming kbdapscript kbhowto KB285353
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please