Results 1 to 8 of 8
  1. #1
    erinhan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    4

    Adding Information to an Existing Field with Command Button

    I'm a total newb as far as Access is concerned but have managed to create a small database which I use to track customer equipment claims. Without going into the whole story I have a 'New Comment' field in which a user can enter a new comment about the claim. I have a command button (with no command assigned) that says 'Add New'. When that button is clicked, I want the comment that was just entered to go into a field I've named 'Comment History'. My thinking is that the 'comment history' will be just that, a listing of all comments made about that particular claim.

    I have no idea where to start to make this happen. Can anyone help? I've attached a screenshot of this part of my db. Thanks

    Click image for larger version. 

Name:	db.png 
Views:	10 
Size:	52.5 KB 
ID:	16451

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Generically:

    Me.HistoryTextbox = Me.HistoryTextbox & " " & Me.NewTextbox

    will add the new to the end.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    erinhan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    4
    Thanks. But does anything specific (i.e. fieldnames) go in anywhere in that expression? And is it applied to the 'add new' button?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Yes, you'd use your actual textbox names. That is VBA code that would go behind the button, yes. If you need it:

    http://www.baldyweb.com/FirstVBA.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    erinhan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    4
    Fantastic. Thanks so much.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem, and welcome to the site by the way!

    I should have added that I probably wouldn't store comments in one field like that. I'd probably have a related table where each comment was a record.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    erinhan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    4
    I wondered about that. But for now, I'm going to try it this way, bc my head is already swimming! I entered the VBA code and it worked! But what would I add to make the new comment 'disappear' from the new box after it's been added to the history box?

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Me.NewTextbox = ""
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. I am stumped...adding field to existing table
    By tanyalee123 in forum Queries
    Replies: 6
    Last Post: 12-09-2013, 06:04 PM
  2. Default Information for an existing field HELP
    By opinionsrfun in forum Access
    Replies: 1
    Last Post: 06-19-2013, 06:30 AM
  3. Adding Pop-ups via Command Button
    By jlclark4 in forum Forms
    Replies: 1
    Last Post: 01-05-2011, 02:41 PM
  4. Replies: 3
    Last Post: 11-02-2010, 10:15 AM
  5. Adding Command Button To Form
    By uneek78 in forum Forms
    Replies: 7
    Last Post: 03-27-2009, 07:43 PM

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