Results 1 to 3 of 3

Thread: Combo

  1. #1
    Join Date
    May 2004
    Posts
    7

    Unanswered: Combo

    Hi,

    I was wondering if anyone could help. Basically, I have a table with a WineBrand field and a UnitPrice that relates to that WineBrand, i.e. Chardonnay is 8 etc.

    I have created a form and I just want to be able to select a WineBrand from a drop-down menu, and then the price for that particular wine is automatically put into a text box called txtWinePrice. How is this achieved?

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    There's a few different methods. One of which would be using DLookup to return the price associated with the winebrand and dump into a text box from the after update event of the combo box. Such a code may look like this:

    txtPrice = DLookup("UnitPrice", "tblWines", "WineBrand = " & yourCombo.Value)

    Note that if the winebrand field is a text datatype, you will need to enclose yourCombo.value in single quotes.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Bac83
    Hi,

    I was wondering if anyone could help. Basically, I have a table with a WineBrand field and a UnitPrice that relates to that WineBrand, i.e. Chardonnay is 8 etc.

    I have created a form and I just want to be able to select a WineBrand from a drop-down menu, and then the price for that particular wine is automatically put into a text box called txtWinePrice. How is this achieved?
    - Or -

    If the combobox is based on a table/query and the price is one of the columns(hidden or not) then you could do the assignment off of the combobox's Column property Ex:

    PriceTxt.Value=WineCombobox.Column(PriceColumnNumb er,WineCombobox.ListIndex)
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •