Solved

me.orderby  returns an error enter parameter value

Posted on 2009-06-29
7
469 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now