Results 1 to 4 of 4

Thread: Update Text Field Based on Combo Box Field

  1. #1
    New Member
    Join Date
    Jan 2019
    Posts
    30
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Update Text Field Based on Combo Box Field

    On a Form, there is a Combo Box Field which lists different Statuses (e.g. Open, Pending, Closed).

    Is it possible for the following to happen?

    When 'Status' is changed from 'Open', add the sentence to the end of the text field 'Comments' to be something like this:
    "05/05/19 - Closed - J.Smith"
    (Date Status Changed) - (New Status) - (Current User)

  2. #2
    Board Regular
    Join Date
    May 2013
    Posts
    648
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Update Text Field Based on Combo Box Field

    Yes, put come code in the AfterUpdate event of the combo
    Code:
    Me.Comment = me.Comment & " " & Me.CloseDate & " - " & Me.cboStatus.Column(1) & " - " & Me.CurrentUser
    You would need to check if an entry already existed though, or perhaps disable the Status combo?
    I am also assuming that the combo has two columns, an ID and descriptive value?
    HTH
    Office 2007
    Access novice. Sometimes trying to give something back

  3. #3
    New Member
    Join Date
    Jan 2019
    Posts
    30
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Update Text Field Based on Combo Box Field

    Quote Originally Posted by welshgasman View Post
    Yes, put come code in the AfterUpdate event of the combo
    Code:
    Me.Comment = me.Comment & " " & Me.CloseDate & " - " & Me.cboStatus.Column(1) & " - " & Me.CurrentUser
    You would need to check if an entry already existed though, or perhaps disable the Status combo?
    I am also assuming that the combo has two columns, an ID and descriptive value?
    HTH
    Is there a way which this could only run if the value changed from "Open" to a different value? (Also the combo only has the one column - the description)
    Last edited by QandAdam; May 6th, 2019 at 07:26 AM.

  4. #4
    Board Regular
    Join Date
    May 2013
    Posts
    648
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Update Text Field Based on Combo Box Field

    Compare against the OldValue property https://docs.microsoft.com/en-us/off...bobox.oldvalue and run the code only then.
    Just use Me.cboStatus in that case.

    HTH
    Office 2007
    Access novice. Sometimes trying to give something back

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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