sjmmajor
asked on
Data Report with data environment
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?
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:
https://www.experts-exchange.com/questions/20766815/Reasons-not-to-use-Data-Enviroment-control-in-VB6.html
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:
https://www.experts-exchange.com/questions/20766815/Reasons-not-to-use-Data-Enviroment-control-in-VB6.html
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for everyones help!
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").V
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.