Applying sort to subform using command button

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
 
P

PC Datasheet

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?
 
G

Guest

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
 
P

PC Datasheet

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?
 

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