Solved

me.orderby  returns an error enter parameter value

Posted on 2009-06-29
7
472 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

860 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