1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Data Access Page

Discussion in 'Business Applications' started by drdrew1469, Jan 20, 2003.

Thread Status:
Not open for further replies.
  1. drdrew1469

    drdrew1469 Thread Starter

    Joined:
    Nov 30, 2000
    Messages:
    436
    Is there anyone who can tell me how to use a combo-box, drop-down, or any version thereof, to control the recordnavigation or override it. My db has 150 records and I don't want click 30 times to get to the "G" names. The current combo-box only allows a single "controlsource" rather than "recordsource" like the recordnavigation control does. Any ideas?

    Thanks,

    Drew
     
  2. RandyG

    RandyG

    Joined:
    Jun 26, 2000
    Messages:
    7,762
    I used Combo boxes to control navigation, and I have 2 of them. ! does a search by compnay name, and the other does it by Order #

    In the properties of the Combo, you select Table/Query for the Row Source Type and in the Row source, you have SELECT [Customers].[CustomerID], [Customers].[CompanyName] FROM Customers ORDER BY [Customers].[CompanyName]; or somethign similar for your database, pointing to whichever table (Customers) and field on that table (Customer iD and CompnayName) you want to have displayed in the box. The ordered by means that the list displayed will be in alphabetical order.

    Then, in the After Update filed of Properties, you insert [Event Procedure] and click on the ... box to the right of the text box, which will bring up your VB window. you need the proper coding which for my DB is:

    Private Sub Combo30_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[CustomerID] = " & Str(Me![Combo30])
    Me.Bookmark = rs.Bookmark
    End Sub

    and you need to make sure that the name of the combo box (Combo30 for me) matches the combo box you have.

    For my OrderID search I have SELECT [Orders].[CustomerID], [Orders].[OrderID] FROM Orders ORDER BY [Orders].[OrderID]; in the Row Source

    and

    Private Sub Combo35_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[CustomerID] = " & Str(Me![Combo35])
    Me.Bookmark = rs.Bookmark
    End Sub


    in VB


    Hopefully this will give you an idea on how to search your own records!;)
     
  3. Anne Troy

    Anne Troy

    Joined:
    Feb 14, 1999
    Messages:
    11,746
    First Name:
    Anne
    If you did a complete install, and you create a form, give the form a header. Drag a combo box into the header of the form and it'll come right out and ask you all the questions you need and do it for ya automatically.

    If you didn't do a complete install, your wizards aren't installed and THEN you have to do it the real hard way, like Randy says.

    If you want a rolodex-type thingee, download MyAddies at www.theofficeexperts.com/downloads.htm.

    If the code's protected, I'll tell you the password in a PM.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/114298

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice