Results 1 to 9 of 9

Thread: Combo Box ???

  1. #1
    Join Date
    Aug 2004
    Posts
    13

    Question Unanswered: Combo Box ???

    I hope there is a simple answer for this...

    I have a combo box that lists Item Description and Unit Price. It fills in the Unit Price field for me. Currently it works great except after an item is picked, if an item with the identical unit price within the list comes first in the alphabet, the item is replaced.

    i.e.
    Grab Hooks - $2.35
    Street Broom Handle - $2.35
    Both are in the Unit Price table. If I select Street Broom Handle. It puts Grab Hooks in my combo box and fills in the unit price of $2.35

    Blue Paint - $1.75
    Green Paint - $1.75
    Yellow Paint - $1.75

    Regardless of what color I pick, Blue Paint is displayed in my combo box.

    If I change the unit price so that it does not match any other item in my table, it will be displayed correctly.

    I used the wizard to create my combo box and my Row Source is:

    SELECT [Unit Price].[Item Description], [Unit Price].[Unit Price] FROM [Unit Price] ORDER BY [Item Description];

    Is there a way to fix this so it displays the correct item?

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    what's the bound column?
    oh yeah... documentation... I have heard of that.

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

  3. #3
    Join Date
    Aug 2004
    Posts
    13
    It's bound to the unit price box but if I change it then it doesn't fill in my unit price.

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    that's your problem. You'll need to bind it to the item description and use the .column() method to pull your price.
    oh yeah... documentation... I have heard of that.

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

  5. #5
    Join Date
    Aug 2004
    Posts
    13
    Thank you.

  6. #6
    Join Date
    Aug 2004
    Posts
    13
    It gives me an error that says:

    Microsoft Office Access can't find the Macro'
    .'

    The macro (or its macro group) doesn't exist, or the macro is new but hasn't been saved. Note that when you enter the macrogroupname.macroname syntax in an argument, you must specify the name the macro's group was last saved under.

    Ok, I'm not a blonde but I didn't realize I did anything with a macro! I am so clueless.

  7. #7
    Join Date
    Aug 2004
    Posts
    13

    I Can't Take It Anymore!

    I finally got the error to go away by deleting the combo box and recreating it. Now on to the next problem.

    I bound the combo box to Item Description. It pulls up the unit price information fine and puts the item description in the box fine. Now I need it to automatically fill in my unit price field for me. I've tried everything I've read in these threads from column() to DLookup to whatever and I cannot get it to work.

    Please help me someone. I want to move on with other work. I don't want to be an access guru. I just want the thing to work right.

    I realize the problem is with my text box.

    Keep in mind that if the item description is left blank, I will need to manually fill in the unit price. Sometimes I will be doing a lump sum entry instead of unit price entry.

    Now, what should the control source be on the "Unit Price" box?
    What should the VB code be to make the unit price automatically fill in and where should I put this code?

    Thank you very, very much.

  8. #8
    Join Date
    Nov 2003
    Location
    San Francisco, CA USA
    Posts
    59

    Use key fields

    You should probably try adding a key field to your Unit Price table and make that a hidden column in your combo box. Then that should be the bound column.

    By this I mean your combo box pulls these three:
    1 Blue Paint - $1.75
    2 Green Paint - $1.75
    3 Yellow Paint - $1.75

    But only this will show
    Blue Paint - $1.75
    Green Paint - $1.75
    Yellow Paint - $1.75

    If you bind your combo box to the first (hidden) column, then it will select and display the correct entry. To hide a column, tell Access that you are using 3 columns, the 1st one is the bound column, and for the column widths put something like 0;1.5";1"

  9. #9
    Join Date
    Sep 2004
    Location
    Reston, VA
    Posts
    86
    SWRodgers - The control source for the UnitPrice textbox should be like this:

    Code:
    =[comboboxname].Column(X)
    Where X is the column number of the Unit Price minus 1. So if the Unit Price is in the second column, X is 1. That should fill in the box every time you change the combo box.

    But, like you said, if you want to be able to manually type in your own value, you will probably have use code in the form module to fill in the textbox when you change the combo box. In the properties for the combo box set the On Change event to [Event Procedure] and use code like this in the procedure:

    Code:
    Private Sub comboboxname_Change()
       textboxname = comboboxname.Column(X)
    End Sub
    That way you'll be able to edit the textbox, whereas you can't if it's bound.

Posting Permissions

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