
VB6 Data Environment & Data Report
SQL in DE:
SELECT * FROM Table WHERE (Field = ?)
The "?" is the variable (use the ?, do not replace) If you go to the parameter
tab
you will see the ? listed as the parameter.
In code to open report:
DataEnv1.Command1 txtField.text 'where txtField.txt is holding the search
variable
ie. employee number.
DataReport1.Show
It works for me.
-Fitz
Quote:
> >> i have 2 questions to ask. one about the Data Environment, and one about
> >> the Data Report.
> >> 1. in the data environment i have built a connection, and a command
> >object.
> >> the command object is using a SQL Statement to create a recordset. my
> >> question is how can i pass a variable into this SQL Select like i would
> in
> >a
> >> recordsource. such as:
> >> "SELECT * FROM Table WHERE Field = '" & Variable & "'"
> >> i want to do this because i often want to search something like a
> customer
> >> table for a specific Last Name the user enters. i hope this is possible
> >to
> >> do.
> >> 2. in a data report how can i print only the selected record in a
> >> recordset. such as if i have an employee recordset and i want to print
> >info
> >> for just one of say 10 employees, how would that be acomplished?
> >> if anyone can help me that would be great. thanks.
> >> Guy