Solved

sorting records at runtime for vb datareport

Posted on 2004-08-28
8
925 Views
Last Modified: 2008-01-09
I have a data report that I have created using data designer with data environment in vb thats select three fields from the same database table. Spaceno, rent, Name. By default when showing the report the space no is sorted(ascending order). How can I program where a user can sort by the name at run time. The user will select that they want to sort by name using a drop down box. I know I can create a seperate report sorted by name and one sorted by spaceno but if the user can select at runtime that would be great.
0
Comment
Question by:captain27
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 5

Accepted Solution

by:
rsriprac earned 25 total points
ID: 11924906
Since reports are not ment to be interactive, I would recommend that you create a forum that calls different reports depending on the drop-down selection in the Form.

I hope this helps.

-Ram
0
 
LVL 3

Assisted Solution

by:CvD
CvD earned 25 total points
ID: 11931869
The best way is to rebuild the report based on the user selection. In other words, change the recordsource of your report to meet the new sorting demands. You could do this most flexible by building a sql-command string and pass it to the recordsource of the report.

I.e. sqlcmd="select Spaceno, rent, name from renttable sort-by ...."

Feed sqlcm to the recordsource prop of your report.

Vaya con Dios
CvD
0
 
LVL 3

Expert Comment

by:CvD
ID: 12160665
I don't agree with you on this, since rsriprac doesn't supply a solution to the question asked. Captain27 asks for a interactive solution in runtime and I am the only one providing him with that solution. Rsriprac provides a static solution on compiletime, containing several forms and thus reports.

Vaya con Dios,
CvD
0
 
LVL 5

Expert Comment

by:rsriprac
ID: 12165319
I disagree CvD, it prefectly answers the question.  It is only ONE form (I said 'a form') that calls multiple reports.  This works prefectly fine so that "user can select at runtime".

I'm sorry but you are wrong about my answer.

-Ram
0
 
LVL 3

Expert Comment

by:CvD
ID: 12167643
Ok, you might be correct there. Some remarks though...

The solution you provide was what the user was able to do already.
Quote: "I know I can create a seperate report sorted by name and one sorted by spaceno but if the user can select at runtime that would be great."

The solution I am providing aims at just what the questioneer wants. A solution at runtime, without the need of creating different reports.

But then again, Im not gonna fight you over 25 points.

Vaya con Dios,
CvD
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

759 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