To create a comment box in the form

Posted on 2004-11-17
Last Modified: 2012-05-05
Hi everyone,

I would like to create a comment box in my form that can be edited before I run the invoice. Here is what I have done so far. Created the following table.
Record #   Date  EmployeeName ClientName  LaborHrs  Rate  WorkDescription
Then I created a form with drop down box that you can select a client to display a subform with the total hours and the rate and total billings amount.
Then I created a click button "Preview Invoice" with "BeginDate" and "EndDate" to display the line item records through another subform.
I would like to create a comment box within the same form to automatically fills in with the texts from "WorkDescription" records on the screen and be able to edit before I send it to "Pint Invoice".

The invoice looks like this.
 from "date" to "date"  xxx hours  labor at "rate"  total amount

Comment:----------------------Description of the work---------------------------------------

Everything is working fine except the comment box on the form and consequently on the invoice.

I really appreciate your help.

Question by:vfv
    LVL 33

    Assisted Solution

    by:Mike Eghtebas
    You may want to change field property to memo to type as much you whish.

    Include this field, WorkDescription, in your form record source query and add its txtbox to your form where you want to edit it.  If you have issues not to cover very much of your form, let me know to discuss it.

    Otherwise, as you navigate through records, WorkDescription ought to appear in txtWorkDescription you just added to your form or subform.  Enter this box and edit it.

    If you want to keep WorkDescription intact but use it to crate a comment field, it is better, to add a new field to your table called Comment.  Similar to above procedure, add it to your query and then to your form.

    Now, your form will show WorkDescription and an empty txtComment, if you want the comment entered automatically, in on current event of your form or subform where txtComment and txtWorkDescription are:

    if(Nz(txtComment,"")<>"" Then  'It will add txtWorkDescription only if txtComment is empty
    txtComment =txtWorkDescription   'if you don't need to show txtComment , make it invisible
    end if

    Or create a button where you can add txtWorkDescription to txtComment on demand, using
    txtComment =txtWorkDescription  

    LVL 4

    Accepted Solution

    Iyou do not want to store the comment in your table, then include the work description in your recordssource, but don't put a bound control on the form.

    Put an unbound control on your form and on the On Current event add the statement txtcomment=me.WorkDescription
    You will then be able to edit it without it interfering with the text stored in the database.

    On the report refer to the form control such as Forms!formname.txtcomment

    You would obviously only be able to use the report when the form was open or it will ask you for the value of the comment field.

    Author Comment

    Hi Mike & Szacks,

    Sorry for late response. I just want to thank you for your comments for solving the problem I am having. I followed your instructions step by step. I am not getting this resolved. I like to give you the lay out of my print invoice form so you would understand what I am trying to accomplish.
    When I open form "Print Invoive"
    Search Customer  ___Combo Box______      You choose the customer you want to bill
    Customer Name ____________________      The customer name will apprear after you choose

    The Project SubForm will appear  looks like this:

              Project Name      Total Labor Hours         Total Amount Billied
               Payable Dept.           120                             3,600.00

     Preview Invoice   When you click "Preview Invoice" box the "Project SubForm will be replaced with "Project Detail SubForm"  looks like this:

    Begin Date_______________ End Date ________________Comment : To Unload food. To count the inventory. To
                                                                                                          Organize the storage.
               Date      Employee         labor             Work Description
             11/15/04   John                 6                 To unload food.
             11/16/04   James               8                 To count the inventory.
             11/17/04   Garry                4                 To organize the storage.  

    Once I type in "Begin Date" and "End Date" the detail listing of the records will appear. I was using the "Comment" box to describe the type of work we've done. Now I like to see the work description to be appeared automatically like you see it above.And be able to go in and edit the wording before I print the invoice.

    Thanks for your patience and help.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    The first two articles in this short series — Using a Criteria Form to Filter Records ( and Building a Custom Filter ( — discuss in some detail how a form can be…
    It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
    In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now