Sorting by Data

M

Matthew DeAngelis

Hi,

I currently have a Transactions form that outputs, in continuous form
view, all of the transactions for a given contact. I would like to
sort it ascending by date; however, it will not do this automatically.
The subform has the Order By: property set to "Calls.[Transaction
Date]", which is the correct field on the table. When the form is
first opened, the dates are out of order. If I click in one of the
date fields, however, and click Sort Ascending, it sorts it properly
for only that usage. If the form is opened again, it reverts to its
old sorting.

Any ideas?

Thanks,
Matt
 
A

Allen Browne

Try creating a query, and specify the sort order there.
Name the query as the Record Source for the subform.

If that doesn't work for you and you want to use the OrderBy property, you
need to set OrderByOn each time the form is opened:

Private Sub Form_Open(Cancel As Integer)
Me.Order By = "[Transaction Date]"
Me.OrderByOn = True
End If
 
M

Matthew DeAngelis

Matthew said:
Allen said:
Try creating a query, and specify the sort order there.
Name the query as the Record Source for the subform.

If that doesn't work for you and you want to use the OrderBy
property, you need to set OrderByOn each time the form is opened:

Private Sub Form_Open(Cancel As Integer)
Me.Order By = "[Transaction Date]"
Me.OrderByOn = True
End If

Thanks...the code works great! I will also consider creating a query
if more problems like this crop up.

Regards,
Matt

Allen,

I realized that I wanted my form to sort by time as well, so I created
a query and had it sort on both date and time. However, the sort does
not take into account AM and PM. (8:00PM is coming before 11:00AM) Do
you know how to modify the query so that it will sort correctly?

Thanks,
Matt
 
M

Matthew DeAngelis

Allen said:
Try creating a query, and specify the sort order there.
Name the query as the Record Source for the subform.

If that doesn't work for you and you want to use the OrderBy
property, you need to set OrderByOn each time the form is opened:

Private Sub Form_Open(Cancel As Integer)
Me.Order By = "[Transaction Date]"
Me.OrderByOn = True
End If



Allen,

I realized that I wanted my form to sort by time as well, so I created
a query and had it sort on both date and time. However, the sort does
not take into account AM and PM. (8:00PM is coming before 11:00AM) Do
you know how to modify the query so that it will sort correctly?

Thanks,
Matt
 

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