Solved

VB 6 Data Report

Posted on 2000-03-21
8
248 Views
Last Modified: 2010-05-18
How do i create a Data Environment Command that specifically obtain
a record in a database by matching a value (C0001) passed to it
during run-time? Thus the data report will then refer to this
datasource to display that particular record only.

For example a customer database has many customer numbers.
I created a form to display customer details. How do I specifically
call a report to print any ONE of the customer details.

0
Comment
Question by:yapkokhian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Author Comment

by:yapkokhian
ID: 2639484
Adjusted points from 100 to 200
0
 
LVL 5

Expert Comment

by:Voodooman
ID: 2639499
For what its worth the data environment has more bugs than my old cat so I dont use it. Passing Parameters is a hit and miss affair.

Its really easy to create your own data environment.

Create a Class Called DataEnvObj.

Stick your own routines in it and you will have your own perfect DataEnv.

Voodooman!
0
 

Author Comment

by:yapkokhian
ID: 2639526
Edited text of question.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:p_biggelaar
ID: 2639530
If you do want to use the data environment, you should add a command and then write a SQL string with a parameter. At run-time you can assign a value to this parameter and run the datareport. If you need an example, let me know...
0
 

Accepted Solution

by:
jdhananjay earned 200 total points
ID: 2639557
hi
try this out

In Dataenvironment write a command

1)this is in General tab of  
  dataenvironment

Select * from customer where custcode = ?

2) In the Paramentrs tab write dataype
   of ur table field(here datatype of
   Custcode) And Host Data Type.
3)Now in ur Form from where u r
  seneding  Custcode write following
  code

dataenvironment1.connection1.open
dataenvironment.Command1(C0001) 'Send  
Custcode from here

datareport1.show

Try this out
if problem then mail me at hijai23@yahoo.com


Good Luck
Jay

0
 

Expert Comment

by:bmscholl
ID: 2639979
set the properties of the command to be a SQL statement; something like the following:

select * from <tablename> where <field> = ?

The <tablename> is the name of the table in your database and the <field> is the field in the database that you want to query.

In the Parameters section of the command properties give the parameter a name and make sure that the data type is the set as the same type as the field.

In the code where you are going to show the datareport  use the following:

DataEnvironment1.Command1 frmForm1.lblCustomer1
DataReport1.Show

Where lblCustomer1 is a label on the form that is equal to what you want.
0
 
LVL 2

Expert Comment

by:p_biggelaar
ID: 2640125
To yapkokhian:

Please do not accept the proposed answer of bmscholl. He didn't add anything to the comments that were already given by me and jdhananjay. If you needed the extra info on the 'HOW TO' part, then accept jdhananjay's comment as answer.
0
 

Author Comment

by:yapkokhian
ID: 2642897
jdhananjay's comment is similar to the answer
thus would be accepted as an answer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

740 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