Need code for dialog for dialog box to sort.

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

Guest

Hi all

I have an equipment tracking form where I need to sort by Equipment or by
Start Date. I would like to use an option group. Can someone help me with the
code?

Thanks
 
try the following scenario: option group control named grpOptions. two
options, one for equipment and one for start date, with an option value of 1
and 2, respectively. the following code added to the option group control's
Click event procedure, as

Select Case Me!grpOptions
Case 1
Me.OrderBy = "Equipment"
Case 2
Me.OrderBy = "StartDate"
End Select

Me.OrderByOn = True

the above assumes that the names of the two fields are "Equipment" and
"StartDate".

hth
 
Perfect! Your the best. It looks so easy, maybe someday it will be for me.
Let me ask you one other scenario: What if I wanted to use command buttons
for those fields instead of the option box, similar to the way it's done in
Outlook? Could you show me how to do that? I would like to have that option.
Also, I am going to add a third field, "Name".

Thanks again.
 
if you're only sorting on one field at a time, it's easy enough. try the
following scenario: three command buttons, named cmdEquipment,
cmdStartDate, and cmdName, respectively. (note, if you really have a field
in your table called "Name", recommend you change it. see
http://home.att.net/~california.db/tips.html#aTip5 for more information.)

add the following code to cmdEquipment's Click event, as

Me.OrderBy = "Equipment"
Me.OrderByOn = True

add the following code to cmdStartDate's Click event, as

Me.OrderBy = "StartDate"
Me.OrderByOn = True

and do the same to the third command button.

hth
 
Thanks again. No, I am not using "name". Thanks for telling me that.
I appreciate the help.
 

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

Back
Top