Saving comments to a Form

Nothnless

Board Regular
Joined
Apr 28, 2016
Messages
142
Hi, I have a nice little form for comments that works like this:

Code:
Private Sub cmdAppendComment_Click()
If (IsNull(txtNewComment.Value)) Then
    MsgBox ("Please enter a comment")
   
    Exit Sub
  End If
 
  If (IsNull(txtComment.Value)) Then
    txtComment.Value = txtNewComment.Value & " - " & _
               VBA.DateTime.Date & "  " & VBA.DateTime.Time
  Else
    txtComment.Value = txtComment.Value & _
               vbNewLine & vbNewLine & _
               txtNewComment.Value & " - " & _
               VBA.DateTime.Date & "  " & VBA.DateTime.Time
  End If
 
  txtNewComment.Value = ""
 
End Sub

There is also a textbox called Pharmacy Number on the form. I want to be able to save my notes to the number (which changes based on a selection from a subform) displayed in the Pharmacy Number textbox. It should display no comments if the Pharm# is blank or if I haven't added any comments under that number yet.

Example: Lets say the Pharmacy Number is 5555 and I save a comment that says "Letter 1 Sent" then I change the Pharmacy Number to 9999 (via subform selection) now the comments form should be blank. If I go back to Pharmacy Number 5555 I should see my comments I wrote earlier.

Can anyone please help with the saving comments to a Pharmacy Number part?

Thank you!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
If you are on rec 5555, the open form for comment to using rec 5555.
it will stay.
change the form rec to 9999 has no affect on 5555.

are you using subforms?
 
Upvote 0
If you are on rec 5555, the open form for comment to using rec 5555.
it will stay.
change the form rec to 9999 has no affect on 5555.

are you using subforms?


No, that doesnt happen. The comment populates on all the records. When I go to the next record my comment from the previous record is still there. Then when I close the form the comments disappear.

No Im not using a subform but I might.
 
Upvote 0
Which field in which table are you using for the comments?
 
Upvote 0

Forum statistics

Threads
1,221,704
Messages
6,161,390
Members
451,701
Latest member
ckrings

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top