473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Sorting issue when filtering

DJRhino1175
221 128KB
Expand|Select|Wrap|Line Numbers
  1. Private Sub ApplyFilter_Click()
  2.  
  3. On Error GoTo ErrorHandler
  4.  
  5.     Dim strFilter As String
  6.  
  7.     strFilter = ""
  8.     If Not IsNull(Me.cmbSearchDate) Then
  9.         strFilter = _
  10.             " AND [LineDate] = " & _
  11.                 "#" & Format(Me.cmbSearchDate, "mm-dd-yyyy") & "#"
  12.     End If
  13.  
  14.     If Not IsNull(Me.CmbLineSearch) Then
  15.         strFilter = _
  16.             strFilter & _
  17.                 " AND [LineNo] = " & _
  18.                     Me.CmbLineSearch
  19.     End If
  20.  
  21.     If Not IsNull(Me.cmbShiftSearch) Then
  22.         strFilter = _
  23.             strFilter & _
  24.                 " AND [Shift] = " & _
  25.                      Me.cmbShiftSearch
  26.     End If
  27.  
  28.     Me.OrderByOn = True
  29.     Me.OrderBy = "[LineNO]"
  30.  
  31.     Debug.Print Mid(strFilter, 6)
  32.  
  33.     Debug.Print Me.OrderBy = "[LineNO]"
  34.  
  35.     With Me.Form
  36.         .Filter = Mid(strFilter, 6)
  37.         .FilterOn = (Not strFilter = "")
  38.  
  39.     End With
  40.  
  41. ErrorHandler:
  42.    ' Insert code to handle the error here
  43.    Resume Next
  44.  
  45. End Sub
It doesn't through any kind of error but it doesn't sort the field I want. It Seems to sort by the forms PK.

Is there something I have entered wrong? Do I need to take the sort out of the query? Do I need to set focus to that field first?
Aug 16 '19 #1
1 950
DJRhino1175
221 128KB
I figured it out, it should have been:

Expand|Select|Wrap|Line Numbers
  1.  Me.OrderByOn = True
  2.     Me.OrderBy = "[LineNOID]"
Aug 16 '19 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script :...
0
by: Keith Shearer | last post by:
I'm having a bit of trouble, moving between controls, when filtering on a form. I'm using a continuous form. At the top I have 2 date fields. I want to filter the data specified between the two...
1
by: Gary | last post by:
Hi, We are facing a typical problem with sorting a datagrid in Windows application ( c# ) The scenario We have a datagrid which is binded to a dataview which conatins two columns say Name...
1
by: bob | last post by:
Currently i'm writing some low level communication modules in C++ and is thinking of putting it into a library so that it can be used in C#. My concern is the performance issue when putting C++...
0
by: DBC User | last post by:
I have a data grid. In it, it has 4 columns. I allow the user to sort the gird by column. I have around 1000 rows in my data grid. There is one column called status. The user sorts on status and it...
0
by: jobo | last post by:
Hey there, I'm having a problem getting sorting to work. Here's what the GridView looks like: "server" ID="updt1" Mode="Conditional">
4
by: Amit | last post by:
Hi All, Is there a way how to sort a DataGridViewComboBoxColumn by its DisplayMember instead of the ValueMember Thanks, Amit
4
by: Gilberto | last post by:
Hello, I have a report with some product information and i needed to create a NEW SORTING LEVEL with some TOTAL calculations which where located at the REPORT FOOTER, just so that they could be...
5
by: Mike | last post by:
I have several datagirds that allow sorting on two date columns. The sorting works but its not showing the newest date first when I sort. For example if I have dates in my column as 01/01/2008...
0
by: fmwsvc | last post by:
We are facing an issue when adding a client uri context in httpd.conf we are migrating iplanet to apache source OS version: Oracle Solaris on SPARC (64-bit) version 10 Source web server:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.