Solved

VB 6 Data Report

Posted on 2000-03-21
8
249 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

736 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