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
Solved

VB 6 Data Report

Posted on 2000-03-21
8
247 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

840 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