Link to home
Start Free TrialLog in
Avatar of Rickstar
Rickstar

asked on

Adding Notes In Database

Hello, I have a database of customers that has a column to add notes about the customer. each note will have the current date and time the note was entered along with the note itself.

my problem: I am currently trying to do this using a screen that has RTF embedded.  when this screen opens up it should have all the notes for the current customer and the ability to add more notes which will be update to the customers notes column.  After hours of working on this I have not been able to make it work.  

So can some tell me how companies add notes about a customer and view those very notes for the specific customer if need be?

This is my last 70 points I just dont have anymore until I get my allowance from my wife  Please help
Avatar of David Lee
David Lee
Flag of United States of America image

Rickstar - This seems so easy that I'm afraid I'm missing something.  Let me make sure I understand the situation.  You have a database of customers.  The structure of that database includes a notes field.  You want the notes field to contain a running history of notes for each customer.  So, for example, if there were a record in the database for me, then the notes field in my record would have a running history of notes for me.  The notes themselves will appear in an RichTextBox control.  Do I have it right?  If so, then the following should solve the problem.

1.  As the program moves from record to record and populates whatever controls you have on your form, set the RichTextBox control to the value of the notes field from the current record.

2.  Use the Change event for the RichTextBox control to detect whether the user altered the notes field.  I'd recommend creating a boolean variable for this.  Set the variable to false each time the program moves to a new record.

3.  Before completing a move to another record test the variable from step #2.  If it's false, then the notes field wasn't altered and you can move on.  If it's true, then the notes field was changed and you need to save it by updating the current record.  If you want to add a date/time stamp to the note, then use something like this:

  RichTextBox.Text = Date & " " & Time & vbCrLf & RichTextBox.Text

Overall it'll look something like this:

Dim bolRecordChanged As Boolean

Private Sub RichTextBox1_Change()
    bolRecordChanged = True
End Sub

Private Sub GoToAnotherRecord()
    If bolRecordChanged Then
        RichTextBox1.Text = Date & " " & Time & vbCrLf & RichTextBox1.Text
        'Code to update the record goes here
    End If
    bolRecordChanged = False
    'Code to move to another record goes here
    'Code to load the record fields into the controls goes here
    'The code for the Notes field (RichTextBox1 control) will look something like:
    '  RichTextBox1.Text = Record.Fields("Notes")
End Sub
ASKER CERTIFIED SOLUTION
Avatar of jmwheeler
jmwheeler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
jmwheeler,

Good solution.  I'm curious though why you chose to store the notes in a separate file instead of in the database?
Avatar of Rickstar
Rickstar

ASKER

Thanks, it worked.  I use color in my RTF boxes. Not sure if my access database would store such color formatting. What do you think?
It works just fine.  You just need to remember to save/load the TextRTF property of the RichTextBox control.
I often use access to store data and it limits the size of your data to 255 characters.
jmwheeler,

That's only if you use a text field in the database.  Memo fields store 64K.  You can save the contents of a TextBox or a RichTextBox into either one.  Naturally in this case a memo field would be what's needed.
Learn something new everyday.