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

    How do I save a "add a comment" into a text box?


    In the Contacts template there is a place on the Contact form at the bottom that has "Add a comment." When you type your comment in and select 'Save' it then date and time stamps that comment and it appears in a box that is located above. That comment is then saved and visible any time the contact is viewed. How is this done?

  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,530
    You should be able to look at the code/macro behind the save button. Likely something like:

    Me.OtherTextbox = Me.OtherTextbox & Now() & " " & Me.EntryTextbox
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,965
    I am looking at the Desktop Contacts template and not finding the described form and feature.

    I expect there is some code behind the button. If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Here's a 'how to' I worked up, a couple of years ago, which only allowed the end users to enter data into a Memo Field indirectly. In this case the object was to prevent a user from changing notes, once they had been entered (these were patients' notes being entered by health care workers) requiring them to add a correction note, while the original note remained as part of the Record. Developed for a different reason, but it does the task you've outlined and should provide you with the guidance you need.

    ****************************


    In this example, there are two Memo Field Textboxes, but only one is Bound, since the other one is simply a temporary holding area. The Bound Memo Field Textbox, named CommentsField, here, must have its Locked Property set to Yes/True, so that all data entry has to be done through the temporary Textbox.

    TempDataBox is Unbound, and in the Property Pane its Visible Property must be set originally set to 'No.' I place mine side by side with the CommentsField Textbox so that the user can refer to what's currently in the CommentsField Textbox while entering new notes.

    Once again, the CommentsField Textbox is Bound to the Form's underlying Table/Query, and its Locked Property is set to 'Yes.'

    Place a Command Button on the Form. Name it IndirectDataInput and in the Properties Pane set its Caption to "Add New Data"

    Now use this code:

    Code:
    Private Sub IndirectDataInput_Click()
    If IndirectDataInput.Caption = "Add New Data" Then
       TempDataBox.Visible = True
       TempDataBox.SetFocus
       IndirectDataInput.Caption = "Commit Data"
    Else
       IndirectDataInput.Caption = "Add New Data"
       If IsNull(Me.CommentsField) Then
          If Len(Me.TempDataBox) > 0 Then
            Me.CommentsField = Now() & "  " & Me.TempDataBox
            Me.TempDataBox = ""
            TempDataBox.Visible = False
          Else
            TempDataBox.Visible = False
          End If
        Else
          If Len(Me.TempDataBox) > 0 Then
           Me.CommentsField = Me.CommentsField & vbNewLine & Now() & "  " & Me.TempDataBox
           Me.TempDataBox = ""
           TempDataBox.Visible = False
     
          Else
           TempDataBox.Visible = False
          End If
          
        End If
    End If
    End Sub

    So, you click on the Command Button, the temporary Textbox appears, you enter your new data, click the Button again, the data is added to the Memo Field Textbox, and the temporary Textbox disappears.

    You'll have to replace CommentsField, in the code above, with the actual name of the Textbox on your Form that is Bound to your Memo Field.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 2
    Last Post: 10-01-2014, 12:38 PM
  2. Replies: 1
    Last Post: 04-23-2013, 08:35 AM
  3. Replies: 3
    Last Post: 04-22-2013, 06:08 AM
  4. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  5. Replies: 11
    Last Post: 11-26-2010, 10:53 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