AfterUpdate Event for auto fill

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MNNovice
    Contributor
    • Aug 2008
    • 418

    AfterUpdate Event for auto fill

    I have a table called tblFunds with these fields: FundID (PK / Auto), FundNo (Text), FundDescr(Text), GrantNo (Text).

    In a form I have several fields that came from different tables. Two of the fields came from the tblFunds: FundID (Name: cboFund) and GrantNo (txtGrant). I have this After Update Event for FundID:
    Private Sub cboFund_AfterUp date()
    Me.txtGrant = Me.cboFund.Colu mn(3)
    End Sub

    But it’s not populating the Grant Number upon entering the fund number and leaving it blank. What am I doing wrong?

    Thanks.
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    I would guess that it is because the combo box columns are zero indexed. Should it be .Column(2)?

    Comment

    • MNNovice
      Contributor
      • Aug 2008
      • 418

      #3
      I have:
      Bound Column: 1
      Column Counts: 3
      Column Heads: No
      Column Width: 0”;1”;1”;

      Comment

      • ChipR
        Recognized Expert Top Contributor
        • Jul 2008
        • 1289

        #4
        So you have .Column(0), .Column(1), and .Column(2)

        Comment

        • MNNovice
          Contributor
          • Aug 2008
          • 418

          #5
          Are you suggesting I have wrong column widths? Since the table has four columns and I want the 4th column to pull the data from (which the GrantNo) the column widths should be 0";1";1";1";

          I don't think I am understanding. Forgive me but I am new at this things.

          Thanks.

          Comment

          • ChipR
            Recognized Expert Top Contributor
            • Jul 2008
            • 1289

            #6
            The table may have four columns, but the combo box does not. You may need to change or redo the combo box.

            Comment

            • MNNovice
              Contributor
              • Aug 2008
              • 418

              #7
              My combo box on the form is called: cboFund. Post #3 refers to what is shown on Format Tab of cboFund.

              Do I read you correct? Thanks.

              Comment

              • ChipR
                Recognized Expert Top Contributor
                • Jul 2008
                • 1289

                #8
                Right, your combo box has 3 columns. If you want to get the number in the third comlumn, you want cboFund.Column( 2).

                Comment

                • MNNovice
                  Contributor
                  • Aug 2008
                  • 418

                  #9
                  I changed it to read:
                  Code:
                  Private Sub cboFund_AfterUpdate()
                  Me.txtGrant = Me.cboFund.Column(2)
                  End Sub
                  End result was the same. No data in txtGrant
                  Last edited by NeoPa; Apr 28 '09, 04:42 PM. Reason: Please use the [CODE] tags provided

                  Comment

                  • ChipR
                    Recognized Expert Top Contributor
                    • Jul 2008
                    • 1289

                    #10
                    What's the data source for cboFund?

                    Comment

                    • MNNovice
                      Contributor
                      • Aug 2008
                      • 418

                      #11
                      I have a table called tblFunds with these fields: FundID (PK / Auto), FundNo (Text), FundDescr(Text) , GrantNo (Text).

                      cboFund is pulling data from FundID

                      Comment

                      • ChipR
                        Recognized Expert Top Contributor
                        • Jul 2008
                        • 1289

                        #12
                        What's in the other columns then?

                        Comment

                        • MNNovice
                          Contributor
                          • Aug 2008
                          • 418

                          #13
                          Are you asking the data in tblFunds?

                          FundID: PK (Auto)
                          FundNo: Text (Let's say Fund number is 872)
                          FundDescr: Text (in this example: 872 is UPA)
                          GrantNo: Text (in this example: MN040012)

                          Comment

                          • NeoPa
                            Recognized Expert Moderator MVP
                            • Oct 2006
                            • 32645

                            #14
                            M,

                            Your GrantNo field is not included in your ComboBox control, so it is in none of the columns.

                            Comment

                            • MNNovice
                              Contributor
                              • Aug 2008
                              • 418

                              #15
                              NeoPa:

                              I thought that's what I did. Please see post #5. And thanks for keeping an eye for this novice.

                              Comment

                              Working...