Run-time error ‘3146’:
ODBC—call failed.
[Microsoft][ODBC SQL SERVER Driver][SQL Server]The ORDER BY position number 0 is out of range of the number of items in the select list.(#108)
The text above is the error that I am getting when I try to sort a column in my form.I am not able to understand what this error is supposed to mean.
Here is the code that I am using to sort the column,in case required.
If I need to sort a column which has "No" as its control source and the header of the column is named lblPMNO
the I use this code,
In case the recordsource of the form is expected:
ODBC—call failed.
[Microsoft][ODBC SQL SERVER Driver][SQL Server]The ORDER BY position number 0 is out of range of the number of items in the select list.(#108)
The text above is the error that I am getting when I try to sort a column in my form.I am not able to understand what this error is supposed to mean.
Here is the code that I am using to sort the column,in case required.
Code:
Private Function ReOrder(vField As String) Screen.MousePointer = MouseBusy Me.OrderByOn = True If Right(Me.OrderBy, 3) = "ESC" Then 'alleen laatste drie letters resolven Me.OrderBy = vField & " ASC" Else Me.OrderBy = vField & " DESC" End If Me.Refresh 'requery Screen.MousePointer = MouseNormal End Function
the I use this code,
Code:
Private Sub lblPMNO_Click() Reorder "No" End Sub
Code:
SELECT DISTINCTROW tblMIMAIN.A_EQUIPDESCR AS Equipment, tblMIMAIN.A_EQUIPNO AS [No], tblMIMAIN.A_ID, tblMIMAIN.A_LOCATION AS Location, IIf(IsNull(tblMIMAIN! A_PROJECTID)," ","**13Mplan**") AS 13Months FROM tblMIMAIN WHERE (((tblMIMAIN.A_LOCATION)>IIf(GetAsset() ="**ALL**","a","ZZ") Or (tblMIMAIN.A_LOCATION)=GetAsset()) AND ((tblMIMAIN.A_SYSTEM)="STW"));
Comment