Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Data Report with data environment

Posted on 2003-10-27
4
Medium Priority
?
325 Views
Last Modified: 2012-06-21
Can you use a parameter or filter so that when someone runs the report (for example: the can select a date) it will only show that data?  And how would you do that?  Can you give me an example?

0
Comment
Question by:sjmmajor
4 Comments
 
LVL 3

Expert Comment

by:gafoorgk
ID: 9628674
yes u can. if u have already defined DataEnvironment and Command objects use the following code as a template

    With deConfiguration
        If (.rscmnAreaList.State = adStateOpen) Then  .rscmnAreaList.Close
       
        With .Commands("cmnAreaList")
            .CommandText = _
                    "SELECT * FROM AREA " & _
                    "WHERE  (AREA_NAME LIKE @AreaName) " & _
                     "ORDER BY AREA_NAME"
            .Parameters("@AreaName").Value = strAreaName
         End With

        .cmnAreaList
    End With


u can also create the same query in design time. then automatically @AreaName will appear in Parameters tab of Command object property dialog box, for which u can set variables in run time.
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9629118
Or, like this

strSQL = "SELECT * FROM MYTable WHERE AREA_NAME LIKE '" & @AreaName & "' ORDER BY AREA_NAME"  
With DE.rsCmd1
    If  .State=adStateOpen  Then .Close
    .Source = strSQL
    .Open
End With

Also, please read this item as to why not to use Data Enviroment in your code:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/VB_Databases/Q_20766815.html
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1000 total points
ID: 9630997
0
 

Author Comment

by:sjmmajor
ID: 9678049
Thanks for everyones help!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

876 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