A form printing problem

Hi,
  I use VB6 + ACCESS and I have some data in the access database.  I would like to print a particular record in tehe database.  I am now using VB6 datareport.  However, it prints all the record!! How can I print a particular record?? Any input requires??

Thanks
Gorexy
gorexyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rovermCommented:
Place a filter on the database or use a DataEnvironment to build a SQL Statement
grtx, RoverM
0
gorexyAuthor Commented:
sorry to reject first
i am new to use dataenvironment and datareport
can u give me an example?
what is grtx and RoverM?
thanks
0
rovermCommented:
grtx = greetings
RoverM is my name !

Okay, make sure to have a connection in your DE (dataenv.).
Add a command to it
Click 'SQL Statement' and type (something like):
SELECT * FROM TABLE
WHERE KEYVALUE = SEARCHVALUE

in this example:
* means: return all field values
KEYVALUE = field in database to reconize which record to fetch
SEARCHVALUE = value which KEYVALUE must equal to.

If you want SEARCHVALUE to be variable then replace it with '?' (without the quotes).
Then you must run the command before accessing the DR with a value for the PARAMETER (see MSDN OnLine).

Easier way:
Click 'SQL Builder' instead of 'SQL Statement' and drag and drop the nessecary table(s) from the DataView window. The SQL statement is automaticly build.

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

gorexyAuthor Commented:
sorry I can't fully understand how can I set the variable in SEARCHVALUE.  I use ? but it said errors.
Pls advise

Gorexy
0
rovermCommented:
assuming:
deDB is your dataenvironment,
comSQL is your SQL command,
strVal is the parameter value
rsResult is a recordset

fire the sql query by:

deDB.Open
rsResult = deDB.comSQL(strVal)

The data will be in rsResult, based on your parameter.
You can also use:

deDB.Open
deDB.comSQL(strVal)

then invoke the datareport, which dataset is set to deDB and the command to comSQL!

0
gorexyAuthor Commented:
I can't use deDB.Open ??
0
gorexyAuthor Commented:
would u mind I send u my code?
0
gorexyAuthor Commented:
I use
dataenvironment1.connection.open
dataenvironment1.command1(input)
datareport1.show

But the second line has problem
how can I pass the parameter "input" into the dataenvironment??
Also, how can I set the variable in dataenvironment??
0
rovermCommented:
don't use brackets!
Further, if you build your sql using the SQL Builder, declaring a condition for a field with '=?' then SQL Builder says something like 'Parameter....'.
Then go to the properties of your command, click the tab 'Parameters' and set all the properties.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gorexyAuthor Commented:
I use
dataenvironment1.connection.open
dataenvironment1.command1(input)
datareport1.show

But the second line has problem
how can I pass the parameter "input" into the dataenvironment??
Also, how can I set the variable in dataenvironment??
0
gorexyAuthor Commented:
Oh finaly I can print it out!
Thanks :>
0
rovermCommented:
Welcome!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.