Solved

Data Report with data environment

Posted on 2003-10-27
4
317 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 69

Accepted Solution

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

Author Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 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

20 Experts available now in Live!

Get 1:1 Help Now