filter datasheet based on empty dates column on top

megatronixs

Registered User.
Local time
Today, 12:53
Joined
Aug 17, 2012
Messages
719
Hi all,

I'm trying to filter a form in datasheet view to display a column called "end_date_working_on" to be on top the ones that have no date.
It should be when the forms open up.
I tried this code:
Code:
'Private Sub Form_Open(Cancel As Integer)
'Me.OrderBy = "end_date_working_on"
'Me.OrderByOn = True
'End Sub
but, it is conflicting with other code that I use to show the details in the form where the subfrom in datasheet view is based. THis code when clicking on the record_id it wil show in the form the details. But with filtering it does not react anymore.
Code:
Private Sub request_id_Click()
DoCmd.OpenForm "frm_request_tool", acViewNormal, , "request_id=" & Me.request_id

End Sub

Any idea how to solve this?

Greetings.
 
if you order by the End_date ascending it will put the blank ones at the top.
 
Hi Minty,
It does the trick with the first code, but then it breaks the second code to open in the form the selected record id.
Is there any way I can put thes order by?

Greetings.
 
Have you tried Ordering the other form on open / load ?
 
yes, I did with below code and without having the last part it works:
Code:
'Private Sub Form_Open(Cancel As Integer)
'Me.OrderBy = "end_date_working_on"
'Me.OrderByOn = True
'End Sub
the empty dates are up, but it breaks the funcionality on the:
Code:
Private Sub request_id_Click()
DoCmd.OpenForm "frm_request_tool", acViewNormal, , "request_id=" & Me.request_id

End Sub
It simply does not show the data from that record Id
maybe becaue the filter is on, it will just skip those and show the data in filterd only

Greetings.
 
You can store the order by property on the form. You don't have to set it in code, have you tried storing the order in the form?
 
ok, I did not try that one, will give it a try if I can find the setting

Greetings.
 
OK, I found it, it is set, but the damn thing does not let the function work to show details for the selected record id, it just sticks there.

Greetings.
 

Users who are viewing this thread

Back
Top Bottom