populate textbox after selecting combobox value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • craig488
    New Member
    • May 2007
    • 6

    populate textbox after selecting combobox value

    hi!

    i have a simple table in access with columns labelled (part numbers) & (targets).

    in the form i have designed i have a combo box linked to this table and i also have a text box in the form as well, what i am trying to achieve is when a part is selected in the combo box is automatically puts the target figure in the text box.

    can anybody help me as well, to put it bluntly i'm useless!!

    cheers
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Originally posted by craig488
    hi!

    i have a simple table in access with columns labelled (part numbers) & (targets).

    in the form i have designed i have a combo box linked to this table and i also have a text box in the form as well, what i am trying to achieve is when a part is selected in the combo box is automatically puts the target figure in the text box.

    can anybody help me as well, to put it bluntly i'm useless!!

    cheers
    What is the name and row source of the combobox?

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32633

      #3
      You may not need a separate control (the TextBox) for this.
      A ComboBox can display one field while, at the same time, have a value of another.
      What exactly are you trying to achieve?

      Comment

      • JConsulting
        Recognized Expert Contributor
        • Apr 2007
        • 603

        #4
        Originally posted by craig488
        hi!

        what i am trying to achieve is when a part is selected in the combo box is automatically puts the target figure in the text box.

        cheers
        When you say Figure...do you mean image?

        Comment

        • craig488
          New Member
          • May 2007
          • 6

          #5
          Originally posted by mmccarthy
          What is the name and row source of the combobox?
          hi!,

          combobox name is combo1 and the row source is table/query.

          cheers

          Comment

          • craig488
            New Member
            • May 2007
            • 6

            #6
            Originally posted by NeoPa
            You may not need a separate control (the TextBox) for this.
            A ComboBox can display one field while, at the same time, have a value of another.
            What exactly are you trying to achieve?
            hi!,


            table: COLUMN 1 (PART No) / COLUMN 2 (TARGET)
            ABC1 / 50

            what i am trying to do is select a part from a combo box on the left of the form which works fine as it is linked to my table e.g. above, so when i select a part (ABC1) in my combo box, i want the target figure to automatically appear in a text box on the right of the form.

            cheers

            Comment

            • craig488
              New Member
              • May 2007
              • 6

              #7
              Originally posted by JConsulting
              When you say Figure...do you mean image?
              hi!

              no i mean a number sorry (each part number has a target number, e.g. so part ABC1 has a target of 50 per hour)

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32633

                #8
                Originally posted by craig488
                hi!,

                combobox name is combo1 and the row source is table/query.

                cheers
                Firstly, congratulations on replying to all the questions posted here.
                In this case though, I think you've posted the Row Source Type instead of the Row Ssource. You may want to dig up the Row Source for Mary.

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32633

                  #9
                  Originally posted by craig488
                  hi!,


                  table: COLUMN 1 (PART No) / COLUMN 2 (TARGET)
                  ABC1 / 50

                  what i am trying to do is select a part from a combo box on the left of the form which works fine as it is linked to my table e.g. above, so when i select a part (ABC1) in my combo box, i want the target figure to automatically appear in a text box on the right of the form.

                  cheers
                  I'm not sure you're following my point exactly here.
                  Never mind, I'll wait for the Row Source to see if that can make things clearer.

                  BTW We will also need the names of both proposed controls. The comboBox and the textBox.

                  Comment

                  • craig488
                    New Member
                    • May 2007
                    • 6

                    #10
                    Originally posted by NeoPa
                    I'm not sure you're following my point exactly here.
                    Never mind, I'll wait for the Row Source to see if that can make things clearer.

                    BTW We will also need the names of both proposed controls. The comboBox and the textBox.
                    Ok all, let's see if i get it correct this time!!!

                    Right, first of all the row source is: SELECT [PARTS].[PART NUMBERS], [PARTS].[TARGETS] FROM [PARTS] ORDER BY [PART NUMBERS];

                    The combo box is called: PARTS
                    And the text box is called: TARGET

                    I hope this covers everything you need

                    Thanks for your patience.

                    Cheers

                    Comment

                    • MMcCarthy
                      Recognized Expert MVP
                      • Aug 2006
                      • 14387

                      #11
                      In the after update event of the combo box you will need the following:
                      Code:
                      Private Sub PARTS_AfterUpdate()
                         Me!TARGET = Me!PARTS.Column(1)
                      End Sub
                      Mary

                      Comment

                      • NeoPa
                        Recognized Expert Moderator MVP
                        • Oct 2006
                        • 32633

                        #12
                        Originally posted by craig488
                        Ok all, let's see if i get it correct this time!!!

                        Right, first of all the row source is: SELECT [PARTS].[PART NUMBERS], [PARTS].[TARGETS] FROM [PARTS] ORDER BY [PART NUMBERS];

                        The combo box is called: PARTS
                        And the text box is called: TARGET

                        I hope this covers everything you need

                        Thanks for your patience.

                        Cheers
                        Bingo! It certainly does.

                        Mary's answer is (almost) exactly what I would have suggested in these circumstances. That should do the trick for you.

                        Comment

                        • PCCTN
                          New Member
                          • Feb 2007
                          • 18

                          #13
                          Originally posted by mmccarthy
                          In the after update event of the combo box you will need the following:
                          Code:
                          Private Sub PARTS_AfterUpdate()
                             Me!TARGET = Me!PARTS.Column(1)
                          End Sub
                          Mary
                          I could really use your help on almost this same thing if you could please look at my other posts. Somebody else is telling me to put it in the control source. I am lost.

                          Comment

                          • NeoPa
                            Recognized Expert Moderator MVP
                            • Oct 2006
                            • 32633

                            #14
                            Originally posted by PCCTN
                            I could really use your help on almost this same thing if you could please look at my other posts. Somebody else is telling me to put it in the control source. I am lost.
                            You need to post a link in here to your other thread then PCCTN.
                            You cannot discuss your question in this thread (that would be called thread-hijacking and is not allowed). Please ask for help if needed to post the link (That we can allow I'm sure).

                            MODERATOR.

                            Comment

                            • craig488
                              New Member
                              • May 2007
                              • 6

                              #15
                              Originally posted by mmccarthy
                              In the after update event of the combo box you will need the following:
                              Code:
                              Private Sub PARTS_AfterUpdate()
                                 Me!TARGET = Me!PARTS.Column(1)
                              End Sub
                              Mary
                              Mary you are Miss God!!!!

                              Thank you very very much, and all the other people that helped on that long route of me giving the right information.

                              Cheers

                              Comment

                              Working...