G
Guest
I have written the public fucntion below to allow a set of records to be
written into an unbound textbox on a form. (I realize that I could do all of
this more easily with a subform in datasheet view but the client wants
otherwise.) The function is called in two places: (1) the OnCurrent event of
the form displaying the records (2) the OnClick event of the form used to
create the records.
My Problem: the order of the recors should be ascending but the records are
writing to the target textbox in the opposite order. Any help?
Public Function writeIDTComments()
Dim db As DAO.Database
Dim rstComments As DAO.Recordset
Dim strWork As String
Set db = CurrentDb
Set rstComments = db.OpenRecordset("SELECT NameAndComment FROM
qryMemberandComment WHERE idFeedbackNumber = " &
Forms!frmFeedbackCollection!idFeedbackNumber & " ORDER BY DateofComment")
Do Until rstComments.EOF
strWork = strWork & rstComments.Fields("NameAndComment")
rstComments.MoveNext
If Not rstComments.EOF Then
strWork = strWork & vbCrLf &
"******************************************************************" & vbCrLf
End If
Loop
rstComments.Close
Forms!frmFeedbackCollection!txtShowComments = strWork
End Function
written into an unbound textbox on a form. (I realize that I could do all of
this more easily with a subform in datasheet view but the client wants
otherwise.) The function is called in two places: (1) the OnCurrent event of
the form displaying the records (2) the OnClick event of the form used to
create the records.
My Problem: the order of the recors should be ascending but the records are
writing to the target textbox in the opposite order. Any help?
Public Function writeIDTComments()
Dim db As DAO.Database
Dim rstComments As DAO.Recordset
Dim strWork As String
Set db = CurrentDb
Set rstComments = db.OpenRecordset("SELECT NameAndComment FROM
qryMemberandComment WHERE idFeedbackNumber = " &
Forms!frmFeedbackCollection!idFeedbackNumber & " ORDER BY DateofComment")
Do Until rstComments.EOF
strWork = strWork & rstComments.Fields("NameAndComment")
rstComments.MoveNext
If Not rstComments.EOF Then
strWork = strWork & vbCrLf &
"******************************************************************" & vbCrLf
End If
Loop
rstComments.Close
Forms!frmFeedbackCollection!txtShowComments = strWork
End Function