Sort Filtered Data

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

Guest

I have a block of code that runs in a form's open event. The code is shown
here. Can anyone tell me how to have the filtered data sorted by a field
called TrDate when the data is displayed?

Private Sub Form_Open(Cancel As Integer)
strDataEntryUserID = UCase(Environ("USERNAME"))
strFilter = "Ucase([INV_USER_ID]) = '" & UCase(strDataEntryUserID) & "'"
Me.Filter = strFilter
Me.FilterOn = True
End Sub

Thanks in advance
 
I have a block of code that runs in a form's open event. The code is shown
here. Can anyone tell me how to have the filtered data sorted by a field
called TrDate when the data is displayed?

Private Sub Form_Open(Cancel As Integer)
strDataEntryUserID = UCase(Environ("USERNAME"))
strFilter = "Ucase([INV_USER_ID]) = '" & UCase(strDataEntryUserID) & "'"
Me.Filter = strFilter
Me.FilterOn = True
End Sub

Thanks in advance

Private Sub Form_Open(Cancel As Integer)
strDataEntryUserID = UCase(Environ("USERNAME"))
strFilter = "Ucase([INV_USER_ID]) = '" & Case(strDataEntryUserID)
& "'"
Me.Filter = strFilter
Me.FilterOn = True
Me.OrderBy = "TrDate"
Me.OrderByOn = True
End Sub
 
Thank you for your response. However, when I tried the method you described,
two things happened. First, before the form opened, I got a prompt for a
parameter value for the date field but the field name showing on the prompt
was an actual date. i.e... Dec/21/04. When I dismissed the parameter prompt
the data was displayed but sorted in "descending" order. Does this make
sense to you?

Thanks again,
Glenn

fredg said:
I have a block of code that runs in a form's open event. The code is shown
here. Can anyone tell me how to have the filtered data sorted by a field
called TrDate when the data is displayed?

Private Sub Form_Open(Cancel As Integer)
strDataEntryUserID = UCase(Environ("USERNAME"))
strFilter = "Ucase([INV_USER_ID]) = '" & UCase(strDataEntryUserID) & "'"
Me.Filter = strFilter
Me.FilterOn = True
End Sub

Thanks in advance

Private Sub Form_Open(Cancel As Integer)
strDataEntryUserID = UCase(Environ("USERNAME"))
strFilter = "Ucase([INV_USER_ID]) = '" & Case(strDataEntryUserID)
& "'"
Me.Filter = strFilter
Me.FilterOn = True
Me.OrderBy = "TrDate"
Me.OrderByOn = True
End Sub
 
There is one other thing I forgot to mention and it may have a bearing on
this situation. The date field, which is actually TransDate, is a
reformatted version of the original date field in the underlying query. The
actual field is a general date which of course contains date AND time, but I
only wanted to display the date so the query grid has this:

TransDate: Format([INVC_TRANS_TIME],"mmm/dd/yy")

Do you think this could be part of the problem?
Thanks again


fredg said:
I have a block of code that runs in a form's open event. The code is shown
here. Can anyone tell me how to have the filtered data sorted by a field
called TrDate when the data is displayed?

Private Sub Form_Open(Cancel As Integer)
strDataEntryUserID = UCase(Environ("USERNAME"))
strFilter = "Ucase([INV_USER_ID]) = '" & UCase(strDataEntryUserID) & "'"
Me.Filter = strFilter
Me.FilterOn = True
End Sub

Thanks in advance

Private Sub Form_Open(Cancel As Integer)
strDataEntryUserID = UCase(Environ("USERNAME"))
strFilter = "Ucase([INV_USER_ID]) = '" & Case(strDataEntryUserID)
& "'"
Me.Filter = strFilter
Me.FilterOn = True
Me.OrderBy = "TrDate"
Me.OrderByOn = True
End Sub
 
Back
Top