?
Solved

VB 6 Data Report

Posted on 2000-03-21
8
Medium Priority
?
251 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
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!

 
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 600 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…
Suggested Courses

762 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