Results 1 to 13 of 13
  1. #1
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding to Running Comments (2000 (SR1))

    Here is the scoop...
    I have a form with 2 "comments" boxes.
    The first is [temp_memo] and is labeled 'Enter new Comments Here'
    The second is [comments] and is view only. I want all old comments to display here.
    There is a 'Submit' button under the first.
    What I need is this...
    A user will enter comments in the first box, click the submit buttom and the comments along with today's date will append to the top of the second box.

    This sounded like an easy thing to do - on click of the button - but I do not know the syntax to use and I am loosing my mind...
    Hence my visit again to the savior site... any thoughts?
    There is always a way.

  2. #2
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding to Running Comments (2000 (SR1))

    Try this for starters -- In the OnClick event for the Submit button, include (something like) the following (VBA) code:

    <font face="Georgia">Me![comments] = Format(Now, "mm/dd/yy hh:mm") & ": " & Me![temp_memo] & vbNewLine & Me![comments]
    Me![temp_memo] = ""
    </font face=georgia>
    Hope this helps.

  3. #3
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding to Running Comments (2000 (SR1))

    Well... this looks great. Let me tell you what happens...
    The "mm/dd/yy hh:mm" shows up in the [comments] box invisible (white text) and the contents of [temp_memo] goes no where.

    I should now add that while this is all happening I would like also to erase the [temp_memo] text, too.
    There is always a way.

  4. #4
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding to Running Comments (2000 (SR1))

    A couple things to check: (1) Are both your comment boxes on the form text controls? (2) Is the fore color (text color) property set to black (or the color you want)?

    Also, although I didn't mention it before, I'd suggest renaming your text controls (which contain the memo text) to something other than the Control Source name (if they are bound fields). E.g., set the Name property for your [comments] field to txtComments. Then reference that in the VBA code (Me!txtComments).

    The second line of code I provided in my prior reply takes care of erasing the [temp_memo] field.

    I did try the code at this end and it works fine here. If you're still having problems, tell us a little more about how you have your form set up (e.g., is the [comments] field bound to a table field?, show us your On Click event procedure, etc.).

  5. #5
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding to Running Comments (2000 (SR1))

    Thanks for helping here is more info:

    The comment box is set as MEMO fields in an attempt to allow for users to not be restricted by a field size - the temp_memo box is a text field

    I will rename the controls, as you suggest.

    Both the [Temp_Memo] and [Comments] fields are bound to a table, 'MasterProcess'

    The On Click Vb is as you said:

    Private Sub Command90_Click()
    Me![Comments] = Format(Now, "mm/dd/yy hh:mm") & ": " & Me![Temp_Memo] & vbNewLine & Me![Comments]
    Me![Temp_Memo] = ""
    End Sub

    I am getting an error to debug :
    Field 'MasterProcess.Temp_Memo' cannot be a zero-legnth string
    There is always a way.

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding to Running Comments (2000 (SR1))

    Have a look at the design of the Masterprocess table.
    Is the Allow Zero Length property for the field Temp_Memo set to Yes ?
    Francois

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adding to Running Comments (2000 (SR1))

    You can, as Fran

  8. #8
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding to Running Comments (2000 (SR1))

    Ah ha! That sneaky little field near the bottom? It is now -and that takes care of the error.

    This is all working with one glitch. When I click submit I must exit the form and return to see them added to the second box. At first it seems as if nothing happens and I am sure this will confuse users of this form.

    Can the changes be made real-time?
    There is always a way.

  9. #9
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding to Running Comments (2000 (SR1))

    That's because the textboxes have the same name as the fields.
    Chang the textboxes names to txtComments and txtTemp_Memo.
    In the code use the names of the textboxes.
    The changes will appear without closing the form.
    Francois

  10. #10
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Adding to Running Comments (2000 (SR1))

    You apparently have the AllowZeroLength property of the field set to No, so it won't let you put a zero-length string into it. But why are you using a bound control for the temporary text in the first place? You could use an unbound textbox on your form and accomplish the same thing without maintaining an empty field in the table.
    Charlotte

  11. #11
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding to Running Comments (2000 (SR1))

    I got it working very well.

    I changed the field to allow zero value and I added a "me!refresh" to the end of the Vb to update all the data in the boxes real time.

    Like this:
    Private Sub Command90_Click()
    Me![Comments] = Format(Now, "mm/dd/yy hh:mm") & ": " & Me![Temp_Memo] & vbNewLine & Me![Comments]
    Me![Temp_Memo] = ""
    Me.Refresh
    End Sub


    If there was one thing that would make this better than my expectation I would ask if you can suggest an addition that would not allow a blank comment to be added. You see, as it sands if the button is pressed and not comments have been typed in the [temp_memo] box the Format(Now, "mm/dd/yy hh:mm") adds to the comments alone.

    As you can see - Calvin is doing the dance of joy already so if there is a suggestion for this last thought he might lose his mind with hysteria.

    Thanks Again!!!
    There is always a way.

  12. #12
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding to Running Comments (2000 (SR1))

    Private Sub Command90_Click()
    If Len(Me![Temp_Memo]) > 0 Then
    Me![Comments] = Format(Now, "mm/dd/yy hh:mm") & ": " & Me![Temp_Memo] & vbNewLine & Me![Comments]
    Me![Temp_Memo] = ""
    Me.Refresh
    End If
    End Sub

    will do it
    Francois

  13. #13
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding to Running Comments (2000 (SR1))

    DONE!!!

    What would life be like without Woody's Lounge!?! You are all awesome and I thank you very much as I bow to your expertise! <img src=/S/bow.gif border=0 alt=bow width=15 height=15>
    There is always a way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •