Results 1 to 8 of 8
  1. #1
    GrayWolf is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    12

    Save data from textbox to table

    Essentially I am trying to duplicate the "comment" command button from the "Issues Web Database" (located here http://office.microsoft.com/en-us/te...010375249.aspx)

    Only, this database is a Web Database and the database that I am updating is not. Not sure if there are many differences, but I have not been able to replicate this function.

    What I have are:
    a Comments table
    a Form


    a subForm

    tblComments - table that tracks the comments separately from the main table
    ID - Autonumber - PK
    MainID - Number - this is the record that the comment is associated to
    CommentDate - Date/Time - the "now()" time that the comment was entered
    Comment - memo - the text field for the comments
    UserID - number - this is the record number for the user who entered the comment

    frmMain

    Dozens of Fields plus the following 2 below (which are key to my issue)
    txtAddComment - unbound - this is a free form text field
    cmdAddaComment - Command Buttom - this button, when pressed, should update the following:
    tblComments.MainID with the record we are currently viewing in frmMain
    tblComments.Comments with the information from txtAddComment
    tblComments.CommentDate with Now()
    tblComments.UserID with GetNetworkUserName()(a module I have)
    and clear the txtAddComment field to be ready for the new comment.

    sbfrmComments
    contains a Report that pulls the related tblComments for the record currently being viewed frmMain.

    Does anyone have any suggestions or require any further information?
    Last edited by June7; 03-12-2012 at 04:06 PM.

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    OnClick, run a query (or DoCmd.RunSQL) that will append a new record to your comments table. Then clear the text box and requery the subform.

    Is this enough information for you?

  3. #3
    GrayWolf is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    12
    Hello,

    Thank you for your response. I had googled this issue and tried a number of different DoCmd.RunSQ snippets. I ended up trying to get this running through macros without success.

    I now get the error message
    "the object doesn't contain the Automation object 'ID.'

    Any suggestions or work arounds?

    I have attached my db if anyone wants to have a look at it.
    Issue Test.zip


  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The best way to tackle a task like this is to create a query outside the form, with the form open and referring to the fields on the form that you need. Once you get this query working, you can then either run it using a macro or vba. Basically that is what you are trying to do, run an append query, and all the other issues are getting in the way of you being able to troubleshoot it.

  5. #5
    GrayWolf is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    12
    Hello,
    Thank you for your suggestion. I am not sure how the append query can assist with my situation. If you review my database that I attached you will see that the comment field does not get stored into a table that needs to be appended to another table.

    Perhaps I am not fully understanding what you are trying to say. I am continuing to research this. if you have any further assistance please let me know.

  6. #6
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I thought that you were trying to add new comment records to the tblComments. Maybe I have misunderstood what you are trying to accomplish here?

  7. #7
    GrayWolf is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    12
    Hello,

    You are correct. I am adding a comment from an unbound text field. I'll research this a bit more and respond. Thank you again.

  8. #8
    GrayWolf is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    12
    Solved:
    I explored your advice a bit more aytee111 and found that your "append query" was spot on. I just disabled the message popups and Voila. Works like a charm.

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

Similar Threads

  1. Replies: 11
    Last Post: 07-24-2012, 07:50 PM
  2. Replies: 4
    Last Post: 12-22-2011, 03:04 AM
  3. Replies: 13
    Last Post: 09-14-2011, 07:19 AM
  4. Replies: 4
    Last Post: 01-05-2011, 07:56 AM
  5. Writing data from textbox to table
    By mll in forum Forms
    Replies: 4
    Last Post: 03-10-2010, 05:10 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