Hi, I have a nice little form for comments that works like this:
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!
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!