Repost Ordering in forms

  • Thread starter Thread starter mon
  • Start date Start date
M

mon

Thanks, Joel, I am using the refresh button and it works
so well that I would now like to do it for the other three
fields I have; Claimant, Client and employee. The due
dates and jobnumber order are the main ones. Also can the
text on the button be changed to say which order it is?
Thanks, Mon
-----Original Message-----
Enter the following code in the click event of the button:
If Me.OrderBy = "JobNumbers" Then
Me.OrderBy = "DueDates"
Else
Me.OrderBy = "JobNumbers"
End If
Me.OrderByOn = True
Hi All, My opening form shows records by critical dates
future dates). A command button opens a form showing open
reports by due dates. On that form I would like a button
to "reorder open reports by their job numbers". Once I
am in that view the button should "reorder open reports
(BACK TO) by due dates)? Thanks Monika
 
Since you want to be able to order by more then 2 fields
i would suggest using the following code:
Select Case Button.Caption
Case "DueDates"
Me.OrderBy = "JobNumber"
Button.Caption = "JobNumber"
Case "JobNumber"
Me.OrderBy = "Claimant"
Button.Caption = "Claimant"
Case "Claimant"
Me.OrderBy = "Client"
Button.Caption = "Client"
Case "Client"
Me.OrderBy = "employee"
Button.Caption = "employee"
Case "employee"
Me.OrderBy = "DueDates"
Button.Caption = "DueDates"
End Select
 
Sory for being slow, but where do I put this code. And
the initial caption would be Due Dates? I've tried this
quickly with just one set of "Case" and an error message
came up with "undefined variabe"???? I put the code in the
click section, and the button was a refresh button??
Thanks again
 
1. Enter the Code in the click event of the Command button
2. Use the Due dates for the Initial caption
3. Where ever it says Button.caption replace the word
Button with the name of your button
4. Where had you received the error on which word
5. What do you call a refresh button
 
The error comes up as soon as I click the button "Compile
error, variable not defined." Refresh is those choices
that can be made through the button wizard, but I made
another button without it and the same message came up. I
am just trying two "case" for a starter. Thanks Mon
 
1.Make a command button without the wizard
2.Set the caption property to Due Dates.
3.Set the name property to cmdSort
4.In the click event copy the following code:
Select Case cmdSort.Caption
Case "Due Dates"
Me.OrderBy = "JobNumber"
Button.Caption = "Job Number"
Case "Job Number"
Me.OrderBy = "Claimant"
Button.Caption = "Claimant"
Case "Claimant"
Me.OrderBy = "Client"
Button.Caption = "Client"
Case "Client"
Me.OrderBy = "Employee"
Button.Caption = "Employee"
Case "Employee"
Me.OrderBy = "DueDates"
Button.Caption = "Due Dates"
End Select
5.On the menu bar select Debug > Compile
If you receive a error Post back the line where you are
receiving the error
 
Sorry the code should be
Select Case cmdSort.Caption
Case "Due Dates"
Me.OrderBy = "JobNumber"
cmdSort.Caption = "Job Number"
Case "Job Number"
Me.OrderBy = "Claimant"
cmdSort.Caption = "Claimant"
Case "Claimant"
Me.OrderBy = "Client"
cmdSort.Caption = "Client"
Case "Client"
Me.OrderBy = "Employee"
cmdSort.Caption = "Employee"
Case "Employee"
Me.OrderBy = "DueDates"
cmdSort.Caption = "Due Dates"
End Select
 
Thanks Joel, that's working now. :=) mon
-----Original Message-----
Sorry the code should be
Select Case cmdSort.Caption
Case "Due Dates"
Me.OrderBy = "JobNumber"
cmdSort.Caption = "Job Number"
Case "Job Number"
Me.OrderBy = "Claimant"
cmdSort.Caption = "Claimant"
Case "Claimant"
Me.OrderBy = "Client"
cmdSort.Caption = "Client"
Case "Client"
Me.OrderBy = "Employee"
cmdSort.Caption = "Employee"
Case "Employee"
Me.OrderBy = "DueDates"
cmdSort.Caption = "Due Dates"
End Select

.
 
Back
Top