Working with Tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hoosierguy
    New Member
    • May 2010
    • 4

    #1

    Working with Tables

    If i have one table box and I input say a number how can I make another box in that same table give me an automatic response?

    Example:

    Employee ID# 1 Returns in differant box as John Doe

    I want to be able to input the 1st box not a drop down box or a combo box...
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    You would need to put some VBA code together in the AfterUpdate event procedure of the TextBox you entered the data into.

    Welcome to Bytes!

    Comment

    • hoosierguy
      New Member
      • May 2010
      • 4

      #3
      Thank you for the welcome...

      I am building a data base for my job and I am stuck on this(for weeks) If I put in a box a fill in number and I want a response in the box next to it that is a description for that number how can would I do that?

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        NeoPa's advice is spot on for use in a form not a table. If you are, in fact, trying to do this directly in a table, the answer is that you can't! And shouldn't! Data should always be entered thru a form based on your table, not directly into your table.

        So are you, in fact, trying to do this in a table?

        Linq ;0)>

        Comment

        • hoosierguy
          New Member
          • May 2010
          • 4

          #5
          OK I am making a Form sorry..not a table...

          I have a list of proposed Items they are numbered and each number has a corrsponding description. I want to be able to input a number to get the discription in another box to appear...

          If I input ITEM BOX the number 12 - I want the box next to it to read ..."Glazed Donuts"

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            Originally you were talking about EmployeeIDs and EmployeeNames, so here's some sample code for that. You can modify it for your new "donot" scenario:

            If EmployeeID is defined as Text

            Code:
            Private Sub txtEmployeeID_AfterUpdate()
             Me.txtEmployeeName = DLookup("EmployeeName", "YourTableName", "[EmployeeID] = '" & Me.txtEmployeeID & "'")
            End Sub
            If EmployeeID is defined as a Number
            Code:
            Private Sub txtEmployeeID_AfterUpdate()
             Me.txtEmployeeName = DLookup("EmployeeName", "YourTableName", "[EmployeeID] = " & Me.txtEmployeeID)
            End Sub
            Linq ;0)>
            Last edited by NeoPa; May 5 '10, 12:05 AM. Reason: Fixed dodgy quote.

            Comment

            • hoosierguy
              New Member
              • May 2010
              • 4

              #7
              thanks alot that will work

              Comment

              • missinglinq
                Recognized Expert Specialist
                • Nov 2006
                • 3533

                #8
                Glad we could help!

                Linq ;0)>

                Comment

                Working...