473,698 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parameter-based sorting

I'm using a form to pass parameters to a query, with results displayed
in a report. Currently, I'm using parameters as filter criteria in
the query, and everything is running smoothly (or so it appears).
However, I'd like to pass sorting parameters (i.e., field names from
one of the tables being queried) via the form, allowing the user to
populate the ORDER BY command. Is it possible to pass sorting
parameters in Access 2000? I can't even replicate the desired
behavior when working directly on the query.

Thanks for the help.

Tim

Jun 20 '07 #1
3 2508
don't try to sort the records at the query level, do it at the report level.
you should be able to set the OrderBy property in the report's Open event,
as

Me.OrderBy = "some field"
Me.OrderByOn = True

you can use a reference to a form control (the form must be open) instead of
a hard-coded string value, or build the string dynamically, then assign it
to the OrderBy property.

hth
"Tim Olson" <ti**@cvenginee ring.comwrote in message
news:11******** *************@n 2g2000hse.googl egroups.com...
I'm using a form to pass parameters to a query, with results displayed
in a report. Currently, I'm using parameters as filter criteria in
the query, and everything is running smoothly (or so it appears).
However, I'd like to pass sorting parameters (i.e., field names from
one of the tables being queried) via the form, allowing the user to
populate the ORDER BY command. Is it possible to pass sorting
parameters in Access 2000? I can't even replicate the desired
behavior when working directly on the query.

Thanks for the help.

Tim

Jun 20 '07 #2
Tina

Thanks. Conceptually, I like doing the sort at the report level
rather than the query level. I was about to ask for some help with
the syntax for passing the parameters to the report for sorting, but I
think I've got it:

Me.OrderBy = "[" & [Forms]![frmParameters]![txtOrder1] & "], [" &
[Forms]![frmParameters]![txtOrder2] & "], [" & [Forms]![frmParameters]!
[txtOrder3] & "]"

Thanks again.

Tim

On Jun 20, 2:08 pm, "tina" <nos...@address .comwrote:
don't try to sort the records at the query level, do it at the report level.
you should be able to set the OrderBy property in the report's Open event,
as

Me.OrderBy = "some field"
Me.OrderByOn = True

you can use a reference to a form control (the form must be open) instead of
a hard-coded string value, or build the string dynamically, then assign it
to the OrderBy property.

hth

"Tim Olson" <t...@cvenginee ring.comwrote in message

news:11******** *************@n 2g2000hse.googl egroups.com...
Jun 21 '07 #3
you're welcome :)
"Tim Olson" <ti**@cvenginee ring.comwrote in message
news:11******** **************@ q75g2000hsh.goo glegroups.com.. .
Tina

Thanks. Conceptually, I like doing the sort at the report level
rather than the query level. I was about to ask for some help with
the syntax for passing the parameters to the report for sorting, but I
think I've got it:

Me.OrderBy = "[" & [Forms]![frmParameters]![txtOrder1] & "], [" &
[Forms]![frmParameters]![txtOrder2] & "], [" & [Forms]![frmParameters]!
[txtOrder3] & "]"

Thanks again.

Tim

On Jun 20, 2:08 pm, "tina" <nos...@address .comwrote:
don't try to sort the records at the query level, do it at the report
level.
you should be able to set the OrderBy property in the report's Open
event,
as

Me.OrderBy = "some field"
Me.OrderByOn = True

you can use a reference to a form control (the form must be open)
instead of
a hard-coded string value, or build the string dynamically, then assign
it
to the OrderBy property.

hth

"Tim Olson" <t...@cvenginee ring.comwrote in message

news:11******** *************@n 2g2000hse.googl egroups.com...

Jun 22 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3831
by: Dan | last post by:
I've run into an interesting problem, and seemed to have stumped 3 newsgroups and 2 other forums. For some reason when I try to insert a record into a SQL table that has a Text column, the returned autogenerated Identity is wrong (on the VB side). This only occurs if the length of the value inserted for the text column is >= 8002. I've included a simple example below.
3
16943
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can create a parameter query in a stored procedure, but how do I use the result set of a parameter query in a select query (in the same or another sp)? In short, if a select query contains a result table that is generated as a parameter query, how do I...
2
2753
by: John A Grandy | last post by:
Is there something special in XML about the name "Parameter" ... I am not able to XPATH query for nodes named "Parameter" <Root> <Category CategoryID="1"> <Elements> <Element ElementID="1"></Element> <Element ElementID="2"></Element> <Element ElementID="3"></Element> </Elements>
2
19336
by: PK | last post by:
Hi, I have an application that opens a Crystal report document and passes in a value to a parameter in the report (pointing to an Oracle DB). However, if I want to pass a "null" value to retrieve all records that have no data for the specified field that the parameter is a condition of (ie. SELECT * from <table> where <field> is null"), it returns nothing. I think CR is building the SQL statement like "SELECT * from <table> where <field>...
7
9562
by: Richard Grant | last post by:
Hi. In c/C++ i can pass the address of a subroutine to another subroutine as an actual parameter How do I do that in VB .NET What should be the syntax for a parameter to receive the address of a subroutine Let's say theres a sub that creates buttons and I want it to receive as a parameter the address of the sub that handles the OnClick event for the button being created How do I pass such a parameter Thanks in advance Richar
3
6884
by: Robert | last post by:
What is the best way to pass a parameter to an ObjectDataSource. I am able to add a new parameter to the SelectParameters, but I would like to just assign a value to an existing parmeter at runtime. Currently I am just adding the parameter at runtime and setting the value: ObjectDataSource1.SelectParameters.Add("searchCCN", "") I would like to accomplish the following: ObjectDataSource1.SelectParameters.("LastName") = "Doe"
4
2753
by: Ranginald | last post by:
Hi, I'm having trouble passing a parameter from my default.aspx page to my default2.aspx page. I have values from a query in a list box and the goal is to pass the "catID" from default.aspx to a stored procedure on the details2.aspx page. I can successfully pass the values from the listbox control to a
16
3159
by: hzmonte | last post by:
Correct me if I am wrong, declaring formal parameters of functions as const, if they should not be/is not changed, has 2 benefits; 1. It tells the program that calls this function that the parameter will not be changed - so don't worry. 2. It tells the implementor and the maintainer of this function that the parameter should not be changed inside the function. And it is for this reason that some people advocate that it is a good idea to...
3
8013
by: Ken Cox [Microsoft MVP] | last post by:
I've been going around and around on this one. I can't believe that it is "by design" as Microsoft says. Here's the situation: In *declarative* syntax, I'm trying to create a default datetime value for a SqlDataSource parameter. (I know how to insert this parameter in code. I want to use declarative markup.) Here's the declarative markup with ???????? indicating where I'm stumped.
5
5303
by: Trevisc | last post by:
Happy Thursday Everyone, I am trying to create a parameter that is one long varchar but that will be used in a SQL statement IN function: //string queryString = GetCurrentTitles(); //Below is for Test string queryString = "45322,32222,33344,55555"; dataset catalogDS = new dataset();
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9023
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4366
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4615
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2327
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.