Solved

Data Report with data environment

Posted on 2003-10-27
4
319 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 250 total points
ID: 9630997
0
 

Author Comment

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

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel VBA combine two working workbooks 8 54
MsgBox 2 54
message box in access 4 46
Send outlook email from VBS Script 2 29
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

770 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