Peculiar record order when writing recordset

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
More info: every comment shows a date (the date the comment was written in
short format even tho it has been specified in General Date format), then the
name of the commenter and then the comment. All additional comments are
writing in ascending order but are grouped according to the commenter. I
would like them to appear in a simple ascending string from earliest to
latest comment irrespective of the person making the comment. The query
being referenced does establish that order when run separately. The
recordset does not reflect the query order.
 
Back
Top