Solved

Adding Notes In Database

Posted on 2004-03-28
8
181 Views
Last Modified: 2010-05-01
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
0
Comment
Question by:Rickstar
  • 4
  • 3
8 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 10700665
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
0
 
LVL 11

Accepted Solution

by:
jmwheeler earned 70 total points
ID: 10703864
I don't know what type of database you are using but I had a similar problem that I solved by saving the information from a RichTextBox in a file and then entering a link to that file in the database.
ex.  RichTextBox1.SaveFile("C:\YourFilePath\YourFileName.???")
      rs![Notes] = "C:\YourFilePath\YourFileName.???")                    'where rs is the name of your RecordSet and Notes is the name of your Field


You can plan a scheme for the filename based on the customer such as CustomerID-CustomerLastName.txt
ex. 1804-Smith.txt

Then when you want to load the data from that file you can use this
ex.  RichTextBox1.LoadFile(rs![Notes])
0
 
LVL 76

Expert Comment

by:David Lee
ID: 10709888
jmwheeler,

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

Author Comment

by:Rickstar
ID: 10709962
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?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 76

Expert Comment

by:David Lee
ID: 10710237
It works just fine.  You just need to remember to save/load the TextRTF property of the RichTextBox control.
0
 
LVL 11

Expert Comment

by:jmwheeler
ID: 10718511
I often use access to store data and it limits the size of your data to 255 characters.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 10719011
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.
0
 
LVL 11

Expert Comment

by:jmwheeler
ID: 10729035
Learn something new everyday.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 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

20 Experts available now in Live!

Get 1:1 Help Now