Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56

    Unanswered: A txtfield automatically fill with value from another txtfield?

    Hi Guys,

    How do I have a textfield automatically fill in with a value after I enter a value in another text field?

    I can do this with a combobox automatically filling a text field with a value, but not txtfield to txtfield. The other complication is that the value being "entered" is an autonumber. You may ask why I need to do this, but it's a long story and has a lot to do with my boss changing the paper filing system to match the database - ahhhhhhh!!!

    So far I have this...any ideas?

    Rusty

    Code:
    Private Sub PersonID_AfterUpdate()
    Me.txtPersonName.Value = Me.PersonID.????
    End Sub

  2. #2
    Join Date
    Jul 2004
    Posts
    64
    Private Sub PersonID_AfterUpdate()
    Me.txtPersonName.Value = Me.PersonID.????
    End Sub

    So which field is the autonumber? Are these fields coming from the same table or different ones? Your code should work as far as I can tell, although you don't really need the .Value at the end AFAIK.

  3. #3
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56
    The field "PersonID" is the autonumber and "txtPersonName" is the slave field that needs to be filled.

  4. #4
    Join Date
    Sep 2003
    Location
    UK
    Posts
    122

    Arrow

    Quote Originally Posted by Rusty's Way
    How do I have a textfield automatically fill in with a value after I enter a value in another text field?

    I can do this with a combobox automatically filling a text field with a value, but not txtfield to txtfield. The other complication is that the value being "entered" is an autonumber. You may ask why I need to do this, but it's a long story and has a lot to do with my boss changing the paper filing system to match the database - ahhhhhhh!!!
    Private Sub PersonID_AfterUpdate()
    txtPersonName.Value = PersonID.value
    End Sub

    if that doesn't work (and I am unsure if it will) try the on_lost_focus event
    Matt the Hat says: "what!?"
    A child of five could understand this! Fetch me a child of five!
    SCARY HARD CHALLENGE: http://www.dbforums.com/showthread.php?threadid=988682

  5. #5
    Join Date
    Jul 2004
    Posts
    64
    So PersonID is a field on the form and not referencing a field in the table, right? I may be a little confused as to why you are wanting essentially a duplicate value in the table.

Posting Permissions

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