Please Help: Append New text to Old text already present in databa

S

sam

Hi All,

I have an excel form which populates access database.

On the form Once we input a student Id in the form, we can input student
records and also add comments, after making the changes we click "Submit" and
the data goes in the databae.
One field that I have on the form is "Comments" Textbox whereTA can insert
their comments for any student.
Here multiple TA's can comment for one student. The issue I want to resolve
is. When a new TA inserts a comment, Old comments are deleted and replaced by
the new comments. Is there a way to append new comments to old comments and
not delete the previous comments made by other TA's?

Hope I made it clear.

Thanks in advance
 
J

JLGWhiz

You should be able to add to the text box content by clicking in the display
window to activate the insertion point (cursor), then type in additional
data.

You can use the properties dialog box to set Multiline to True. Then the
user can press Ctrl + Enter to make a linefeed and carriage return to add a
new line of data.

Not sure what the limit is on characters for a textbox, but there is one.
Probably 255.
 
J

JLGWhiz

After reading your post again, you should disregard my original answer. It
was based on amending text before the form is executed.

To do what you want, you would have to amend the code that posts the data to
Access so that it adds to the comments rather than replacing them. Without
seeing the current code, it is impossible to offer a better solution.
 
S

sam

HI JLGWhiz,

Here is my code to get data from excel form into access:

Dim r as integer, cn As Object, rs As Object

Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")

cn.Open "Provider=Microsoft.ACE.OLEDB.12.0; " & _
"Data Source=C:\Students\Students_Data.accdb; Jet OLEDB:Database
Password=stu1123; "

rs.Open "Students_Data_Table", cn, 1, 3, 2

With rs
.Addnew

.Fields("Student_Number") = Me.StudentNo.Value
.Fields("Student_FName") = Me.FName.Value
.Fields("Student_LName") = Me.LName.Value
.Fields("Student_Major") = Me.Major.Value
.Fields("Student_Level") = Me.Level.Value
.Fields("Student_Age") = Me.Age.Value
.Fields("Comments") = Me.Comments.Value

.Update
End With
r = r + 1

Set cn = Nothing
Set rs = Nothing

Thanks in advance
 
J

JLGWhiz

I know very little about Access programming, but this might work:

.Fields("Comments") = Fields("Comments").Value & _
";" & Me.Comments.Value


The syntax might not be right, but concantenation seems to be the answer.
One problem might be that in Access the data field would be limited in
characters that could be entered.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top