Results 1 to 7 of 7
  1. #1
    Sunny8760 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    43

    Unbound Text Box for Adding Comments to Comments Table

    Hi,



    I've searched many online forums and I cannot find a solution to my problem. The only post that came close to answering my question was this one, https://www.accessforums.net/queries...ory-15580.html, unfortunately, it fell short of showing how to setup the form for adding comments.

    My table structure is as follows:
    tblContactsContactID
    personName
    etc


    tblTasks
    TaskID
    TaskName
    etc


    tblComments
    CommentsID
    CommentBody
    ContactID
    TaskID


    Key:
    Underlined - Table Name
    Bold - Primary Key
    Italics - Foreign Key

    I created a form with a subform to show the Task/Contacts and the Related Comments.


    I have a TasksDetails Form with two tabs. Tab 1 contains information about the Task and Contact. Tab 2 contains comments related to this task.

    My Problem:
    I would like to add a text entry box to Tab 1 and a button to add the text to the Comments Subform on Tab 2. (Clarification: I would like the text from the text box to be added to the Comments table and show in the Comments Subform on Tab 2. I hope this makes more sense.)

    Please provide as much detail as possible, as I'm a novice access user.

    Thank you.
    Last edited by Sunny8760; 04-08-2015 at 05:46 AM.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    I don't think you need a button, When user clicks the COMMENTS tab, the sub form Comments should show.
    this subform should be linked in the ContactID in the master and child fields.
    now you can add many comments for that 1 customer.

  3. #3
    Sunny8760 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    43
    Quote Originally Posted by ranman256 View Post
    I don't think you need a button, When user clicks the COMMENTS tab, the sub form Comments should show.
    this subform should be linked in the ContactID in the master and child fields.
    now you can add many comments for that 1 customer.
    I'm sorry, but I dont understand your comment. Would you mind writing the steps to accomplish what you're suggesting?

  4. #4
    Sunny8760 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    43
    I did some more research and I think I'm going about this in a very wrong way. I believe the right way is to create an append query and add my comment from a field in the Tasks table to the Comments table. I could run this using a button to "officially submit" my comment through to the Comments table. Does anyone agree with this?

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    create an instant form (datasheet) of the COMMENTS table. frmCom
    turn the wizard on
    in your main contact form, place a subform box (off the toolbar) onto the form
    set the subform to frmCom.
    link the fields CONTACTID as master and child

    now you can enter data straight into the form.

  6. #6
    Sunny8760 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    43
    Thanks for the instructions.

    Here's what I did and the results:

    1. I have an input form called TaskDetails
    2. I have two tabs on this form: Tab 1 has information about the tast. Tab 2 has a subform that shows all comments related to the task.*
    3. On Tab 2 and using your instructions, I added a second subform.
    4. As for linking fileds: I can only use the ContactID on the master and must choose from the comments table fields for the child. It will not allow me to chose the ContactsID for the child.

    *I've checked the form in Tab 2 and if I manually enter comments in the Comments table they will show in chronological order. This subform is created via query, it's created directly from the Comments table.

    Results:
    When I enter the first comment the comment is added to the chronology subform.
    When I enter a second comment, first I see that the newly added subform already has the first comment, and then when I write over it, the chronology shows the second comment, but not the first.

    So, I think I'm not actually adding comments after the first comment. I'm simply writing over the first comment.

    Since this did not work, I'm going to try using a script I used before...I will make some modifications to it.

  7. #7
    Sunny8760 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    43
    After messing around with a script that I had from before I was able to add comments and subsequent comments (records) to the comments table.

    I have one issue:

    There are two tables, tblTasks and tblComments joined via primary key to a number filed to tblComments. Anytime I add a new record I would like the primary key added to this field so all the comments related to this task can be displayed on a subform (to show chronology).

    Private Sub IndirectDataInput_Click()
    If IndirectDataInput.Caption = "New Comment" Then
    TempDataBox.SetFocus
    IndirectDataInput.Caption = "Save Comment"
    Else
    IndirectDataInput.Caption = "New Comment"
    If IsNull(Me.tblComments_subform.Form!Commentnote) Then
    If Len(Me.TempDataBox) > 0 Then
    Me.tblComments_subform.Form!Commentnote = Me.TempDataBox
    Me.TempDataBox = ""
    End If
    Else
    If Len(Me.TempDataBox) > 0 Then
    DoCmd.GoToRecord , , acNewRec
    Me.tblComments_subform.Form!Commentnote = Me.TempDataBox
    Me.TempDataBox = ""
    End If

    End If
    End If
    End Sub

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

Similar Threads

  1. Adding date stamp to form comments memo field
    By mikehorse in forum Forms
    Replies: 3
    Last Post: 09-18-2014, 12:30 PM
  2. Need your comments regarding HR database
    By wrkadri in forum Database Design
    Replies: 2
    Last Post: 07-05-2014, 06:19 PM
  3. Comments on Reports
    By John99 in forum Access
    Replies: 1
    Last Post: 11-12-2012, 09:51 AM
  4. Comments History
    By stu in forum Forms
    Replies: 3
    Last Post: 11-15-2011, 06:43 PM
  5. Comments box
    By allykid in forum Forms
    Replies: 1
    Last Post: 07-12-2010, 08:45 AM

Tags for this Thread

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