Sort Filtered Data

G

Glenn Suggs

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
 
F

fredg

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
 
G

Glenn Suggs

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
 
G

Glenn Suggs

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
 

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

Similar Threads


Top