Applying sort to subform using command button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

All I want to do is sort a form based on a date field in ascending order and allow the user to sort the form from a command button, instead of using the toolbar. If my form is called mainForm and the subform subForm, what sort of macro or code do I have to provide?

Thanks in advance,

Jeff
 
It sounds like all you need to do is base your subform on a query rather than a
table and set the sort order in the query to ascending on the date field!!

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Jeff C said:
Hi,

All I want to do is sort a form based on a date field in ascending order and
allow the user to sort the form from a command button, instead of using the
toolbar. If my form is called mainForm and the subform subForm, what sort of
macro or code do I have to provide?
 
Hi,

I already have that. I was just hoping to have the ability to sort by date or by a name field and have buttons to enable those sorts. Is that a possibilty?

Thanks,

Jeff
 
Yes, look at the OrderBy property in the Help file. You would put the following
code in the OnClick event of a button:
Me.OrderByOn = True
Me.OrderBy = "[MyDateFieldname]"

You would do the same for the name field.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Jeff C said:
Hi,

I already have that. I was just hoping to have the ability to sort by date or
by a name field and have buttons to enable those sorts. Is that a possibilty?
 
Back
Top