-
Data Environment / Data Report
Hi all,
It been awhile since I used the Data Environment. One quick question.
How would I get the data report to print only one entry in a database?
I know I could use the SQL in the Command1 object, but I need to have the
user decide on what to view. I guess what I am asking is, how would I use
a custom SQL statement using varibles in code rather than using the command
properities?
Thanks for your help.
Duane...
-
Re: Data Environment / Data Report
"Duane Snelling" <duane.snelling@sympatico.ca> wrote:
>
>Hi all,
>
>It been awhile since I used the Data Environment. One quick question.
>
>How would I get the data report to print only one entry in a database?
>
>I know I could use the SQL in the Command1 object, but I need to have the
>user decide on what to view. I guess what I am asking is, how would I use
>a custom SQL statement using varibles in code rather than using the command
>properities?
>
>Thanks for your help.
>
>Duane...
Duane,
You can do this by using a parameter in the sql of your command object.
First, in the DataEnvironment, edit your command and add your parameter(s)
in the where clause. You can do this by right-cliking on the command object
and selecting properties. Select "SQL Statement", and either type your sql
in the textbox or use the SQL Builder to create it. Either way, it should
look something like-
SELECT *
FROM tblMyTable
WHERE MyField = prmMyParam
Next, you can pass the value into the parameter before you open the report
by doing something like this-
Private Sub cmdOpenReport_Click()
Dim prm As ADODB.Parameter
Load de
With de
If .rsMyCommand.State <> 0 Then
.rsMyCommand.Close
End If
Set prm = .Commands("cmdMyCommand").Parameters("prmMyParam")
End With
prm.Value = "Something"
rptMyReport.Refresh
rptMyReport.Show vbModal
Unload rptMyReport
Set prmMyParam = Nothing
End Sub
HTH,
-Russ.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks