Solved

VB 6 Data Report

Posted on 2000-03-21
8
243 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
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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now