Solved

me.orderby  returns an error enter parameter value

Posted on 2009-06-29
7
473 Views
Last Modified: 2013-11-28
I have a form that I need to change the order that the data is displayed inso I have replaced the "header Labels" with command buttons that I have the following code attached to and a hidden text box for each button that I track the current status of the sort order. When the code runs it errors at the me.orderby requesting me to input a value.

The data source for the form is the following query;
SELECT CredScan.EstNo, Q_ShpSup_QTEovd_w_ExstWSup.[1Job_no], Q_ShpSup_QTEovd_w_ExstWSup.OorC, CredScan.CreditorName, CredScan.CreditorInvNo, CredScan.DateTime, CredScan.ComputerName, Q_ShpSup_QTEovd_w_ExstWSup.InsCo
FROM CredScan INNER JOIN Q_ShpSup_QTEovd_w_ExstWSup ON CredScan.EstNo = Q_ShpSup_QTEovd_w_ExstWSup.Est_no1
ORDER BY CredScan.DateTime DESC;


Please give me a clue, as it is driving me up the wall, thank experts!
Private Sub cbVendorName_Click()
On Error GoTo Err_cbVendorName_Click
 
Dim strCurrSort As String
    If Not IsNull(Me.tbVendorName) Then
      strCurrSort = Me.tbVendorName
    Else
      Me.tbVendorName = "false"
      strCurrSort = Me.tb1VendName
    End If
      
    'Me.tb1VendName
    If strCurrSort = "True" Then
        Me.OrderBy = "tb1VendName DESC"
        Me.OrderByOn = True
        Me!tb1VendName.BackColor = 16777215 '4227200
        Me.tbVendorName = "false"
    Else
        ' Me.tb1VendName a test to verify that I have the syntax for the field name correct
        Me.OrderBy = "tb1VendName ASC"
        Me.OrderByOn = True
        Me.tbVendorName = "True"
        Me!tb1VendName.BackColor = 10998526
    End If
    ' refresh data
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
 
 
Exit_cbVendorName_Click:
    Exit Sub
 
Err_cbVendorName_Click:
    MsgBox Err.Description
    Resume Exit_cbVendorName_Click
    
End Sub

Open in new window

0
Comment
Question by:mdlp
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 13

Expert Comment

by:ioane
ID: 24742061
The value passed to the OrderBy function needs to be the name of one of your columns in the form.
i.e. Me.OrderBy = "CredScan.EstNo DESC"

If tblVendName is a label or variable containing the column name, then it should not be a string.
i.e. Me.OrderBy = tblVendName & " DESC"
0
 
LVL 61

Expert Comment

by:mbizup
ID: 24742064
Are you trying to use tb1VendName to specify the field that you are sorting on?

In other words, does the textbox contain the field name that should be used in the Order By clause?

If that is the case, the following line:

<Me.OrderBy = "tb1VendName DESC">

Should be

Me.OrderBy = me.tb1VendName & "  DESC"

0
 
LVL 75
ID: 24742065
What is the name of the parameter value it's asking for?  Typically this is because a field name is spelled wrong or a mistake in an expression.

mx
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 75
ID: 24742071
wow ... almost 3 simultaneous posts!
0
 

Author Comment

by:mdlp
ID: 24742473
Thank you and yes all at the same time, I just walked in and WHAM!
TamTrak;
Me.OrderBy = tblVendName & " DESC" still produces the same error

Mbizup;
tb1VendName is a text box on the form in the detail section ie a cloumn that is bound to the CredScan.CreditorName and the column that I want  to change the sort order of.
cbVendorName is a command button that is in the form header replacing the label.

DatabaseMX;  I thought the same thing and I have doubled checked the spelling before I sent this to you, I have been embarrased enough to have learned that lesson!  The rest of the code works and changes the back color if I do not input anything and click ok it finishes the if statement and returns me back to the button and I can continue this for ever.  I can manualy highlight the field and click the A-Z or the Z-A and it will sort the column.

Me.OrderBy = "tb1VendName DESC"  From my orig post returns - - an input box, with a header "enter parameter value"  and the description is "tb1VendName" with no "DESC".

Me.OrderBy = Me.tb1VendName & " DESC"  + Me.OrderBy = tb1VendName & " DESC" - produce the same thing  an input box, with a header "enter parameter value" and the description is the field value from the first record on the form ie Joes Crab Shack.

Thats about all I know, I hope this helps.
thanks


Sort-Error.jpg
0
 
LVL 13

Accepted Solution

by:
ioane earned 500 total points
ID: 24742523
Just use this:
Me.OrderBy = "CredScan.CreditorName DESC"
0
 

Author Closing Comment

by:mdlp
ID: 31598215
It is exactly what the doctor ordered!!!!!!!!!!
Thank you to all of the Experts, TamTrak I guess you were right on the path with the;
   Me.OrderBy = "CredScan.EstNo DESC", I f I had just changed it i could have saved us all a lot of work!
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question