Display Dated memo field subform in descending order

S

snowiii

I have a subform that has 2 disstinct memo fields that have a unique
date/time stamp for each new memo record. The data is store to it's own
table and has a one to many relationship with another table.

What I am struggling with is the following:

When I open the primary form (Projects) I want the sub-form (StatusComment)
to show the memo fields with the last comment, first (e.g. on top). In the
subform I have filled in the "Order by" with the date/time field name and
indicated it should be in descending order
(StatusComment.AccomplishmentsDateTime DESC). But when the form opens, it
shows the first memo record in ascending order.

I am looking for any suggestions on how to make this work in the manner I
would like it to..
 
C

Clifford Bass

Hi,

I usually set them explicitly in code in the form's On Open event
rather than in the properties window because the user can sort and filter as
they please and then hit the save button. When the user does that, the next
time the form is opened, it uses that saved sort order and/or filter. Or it
may even save them automatically without any user interaction. Really
annoying! Doing it in code seems to alleviate that problem.

Private Sub Form_Open(Cancel As Integer)

Filter = ""
FilterOn = True
OrderBy = "[MEMO_DATE] desc"
OrderByOn = True

End Sub

Note that if you subsequently modify the form's design, you may well
see the sort order show up in the properties window. Don't worry about it,
it will not matter.

Clifford Bass
 
S

snowiii

This works...Thanks for the speedy and helpful reply...

Clifford Bass said:
Hi,

I usually set them explicitly in code in the form's On Open event
rather than in the properties window because the user can sort and filter as
they please and then hit the save button. When the user does that, the next
time the form is opened, it uses that saved sort order and/or filter. Or it
may even save them automatically without any user interaction. Really
annoying! Doing it in code seems to alleviate that problem.

Private Sub Form_Open(Cancel As Integer)

Filter = ""
FilterOn = True
OrderBy = "[MEMO_DATE] desc"
OrderByOn = True

End Sub

Note that if you subsequently modify the form's design, you may well
see the sort order show up in the properties window. Don't worry about it,
it will not matter.

Clifford Bass

snowiii said:
I have a subform that has 2 disstinct memo fields that have a unique
date/time stamp for each new memo record. The data is store to it's own
table and has a one to many relationship with another table.

What I am struggling with is the following:

When I open the primary form (Projects) I want the sub-form (StatusComment)
to show the memo fields with the last comment, first (e.g. on top). In the
subform I have filled in the "Order by" with the date/time field name and
indicated it should be in descending order
(StatusComment.AccomplishmentsDateTime DESC). But when the form opens, it
shows the first memo record in ascending order.

I am looking for any suggestions on how to make this work in the manner I
would like it to..
 

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