Results 1 to 3 of 3
  1. #1
    Summit_IT is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Location
    Virginia
    Posts
    47

    Append data in a Textbox after a checkbox is checked


    This code works, but I want it to append existing data in a textbox not just replace.

    Code:
    Private Sub PartNeeded_AfterUpdate()
    'This will append the CorrectiveAction textbox with a statement when the PartNeeded checkbox is checked'
    If Me.PartNeeded = True Then Me.txtCorrectiveAction.Value = "Inspected in accordance with manufacturer's maintenance manuals and was found defective. Part was replaced with a serviceable part."
    If Me.PartNeeded = False Then Me.txtCorrectiveAction.Value = Null
    End Sub
    I have six checkboxes I want to use to append this one textbox.
    Also, I want manually entered data to stay in this textbox. This data must also be manually removed if user makes a mistake.

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    5,008
    Me.txtCorrectiveAction = Me.txtCorrectiveAction & " " & "Inspected in accordance with manufacturer's maintenance manuals and was found defective. Part was replaced with a serviceable part."

    Why two If statements?, use an Else instead.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    maybe use the syntax of
    If Me.PartNeeded = True Then Me.txtCorrectiveAction = Me.txtCorrectiveAction & " Inspected in accordance with ...
    Not the injection of a space before the addition. If you want a line feed, concatenate vbCrLf instead of a space.
    Please use proper indentation with code.
    Thanks.

    Too late.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Checkbox checked
    By brandy in forum Programming
    Replies: 2
    Last Post: 01-11-2017, 01:07 AM
  2. Checkbox Always Shows Checked
    By jo15765 in forum Forms
    Replies: 3
    Last Post: 08-16-2016, 06:58 AM
  3. Checkbox data in query: only when checked
    By AsjenW in forum Queries
    Replies: 1
    Last Post: 04-19-2013, 07:43 AM
  4. Append Checkbox Data
    By jgelpi16 in forum Programming
    Replies: 3
    Last Post: 06-29-2010, 04:58 PM
  5. Combining textbox and checkbox data
    By jgarner in forum Access
    Replies: 0
    Last Post: 12-11-2008, 11:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums