Results 1 to 5 of 5
  1. #1
    kc21supra is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2009
    Posts
    3

    Combo box to text box

    hello all,



    Im new to access 2007 and i am still tryint to learn it.

    So i have several tables with two columns each. The two columns are name & price. I have created a form with a combo box for each table. What i am trying to do is be able to select the name from each combo box and have the price show up in the text box. I would like to do this for each combo box. Then i would like a text box that adds up all the text boxs on the forum. IS this possible? Also is there a way to multiply the value in that total text box by a number( say for something like trying to figure total cost with tax)

    Thanks for your help in advance. I hope i made it clear enough.

  2. #2
    SoftwareMatters is offline Access VBA Developers
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    Hi,
    Yes this is all possible. Try this:

    For the purpose of explaining I will call name your combos Combo1, Combo2 and Combo3.

    On your form with the comboboxes create 3 textboxs and name them Total1, Total2 and Total3. Now for the Control Source for each textbox do the following:

    For Total1 put: =[Combo1].[column](1)
    For Total2 put: =[Combo2].[column](2)
    For Total3 put: =[Combo3].[column](3)

    Now add a textbox and name it Multiply and format it as a number.

    Now add a textbox and name it total and format it as currency. Put the following in the Control Source:
    =[Multiply ]*([Total1]+[Total2]+[Total3])

  3. #3
    kc21supra is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2009
    Posts
    3
    Software matters,

    Thanks for your help. I will try to do it shortly. Although i had a couple of questions. When you talk about control source, are you talking about the VBA code? When your talking about the =[Combo1].[column](1), what does 1 next to column do? That is not referring to the number of columns does it? I only ask because in each of my tables, there are only two columns.

    Also how do i format a text box as a number? Didn't know you can even format a text box.

    Thanks,
    KC

  4. #4
    kc21supra is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2009
    Posts
    3
    Okay i found where to enter the control source, however, ill i am getting is a #Name? in the text box. I think i am typing the code in wrong.

    I am working with combo box 12. Currently i have it refrenced to a table (Table 1) with 2 columns (Name and Cost) in it. I have it set up so that you can only see the name of the item in the combo box. Does this need to be changed?

    For my text box i put: =[Combo12].[Cost](1)

    I guess i am not doing this right.

    Thanks,
    KC

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If you want the 2nd column from the Combo12 ComboBox then you need:
    =Combo12.Column(1)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to vertically align text inside a text box ?
    By alexcalgary in forum Forms
    Replies: 2
    Last Post: 10-06-2010, 08:44 AM
  2. Replies: 3
    Last Post: 03-28-2009, 06:06 PM
  3. Replies: 0
    Last Post: 02-24-2009, 12:37 PM
  4. Replies: 0
    Last Post: 08-17-2008, 12:19 PM
  5. Split text field into two text fields
    By Grant in forum Access
    Replies: 6
    Last Post: 01-31-2008, 05:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums