Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Data Report And Data Environment

Hi. I've got a data report which retrieves data from a data environment. However, the data report kept on showing the old data once the data report has been viewed, and won't update until I restart the application. Could someone help me please? I have tried to set DeConnection's CursorLocation to adUseServer, and all DeCommand's CursorType to adOpenDynamic, but it still doesn't work. Is this the right way to do it? If so, how come it still can't update with the record change?

"Keep your mind fit by doing more brainxercise, and eat more mailgetables."

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Data Report Doesnt Print In Data Environment With A Child Command Attached
I am trying to print a report using a Data report linked to a Data Environment recordset.

If I run the command:


when the recordset has a child command attached to it , I get an error.

If I go to the DE and dis-associate the child command with its parent the same command works. I conclude the child command is causing the problem.

Can anyone shed some light on this.


Need Coding For Making Data Report Using Data Environment In Visual Basic 6.0
I would like to know how to write the code to only print out data from a certain date. I know how to set the data environment and drag the field to the report design but do not know how to write the code to only print out a certain data. Please help

My question is this:



How Can Make A Dynamic Report Using Data Report And Data Environment???
what i know is binding certain records using select sql statements. but the problem is that what if i would like to filter and use some conditions to get necessary records to be diplayed on the report using data report and data environment..

what i did was a static report using the tools.. somebody help me to show how to make a dynamic report queries and output it through data report with the help of the data environment.

thank you..

How To Set Connection To Data Environment And Data Report By Code?
Hi, does anyone know how to set up a data report and data environment by using just code?

If anyone can provide me with a sample program or tutorial, please help me. Thanks!

Everyday's like a chocolate, dark, sticky and melt in your hands...

Grouping A Data Report Programically (without Data Environment)
Does anyone know how to do this? I can set up a simple report using a
connection and recordset object but I can't figure out how to add grouping

Dominic Wray

Cannot Drag Fields From Data Environment To Data Report
May I know why can't I drag the fields that I've linked from my Data Environment and put into the report? Once I select Data Report under Designers at the right side of the screen, I can't see anything to put fields into the report. Can anyone advise what should I do?


How To Make 3-column Data Report With Data Environment
Anybody please help me to design 3-column data report with data environment as there is code available for "how to make 2-column data report without data environent".


Connect Data Report With Data Environment Using Parameter
I'm trying to make data report using data environment and using parameter and i'm succeed using this way

Select * from phone Where p_name like ?

but now i need to search for part of <<p_name>> so i'm trying to use this way and i dont succeed

Select * from phone Where p_name like %% ? %%

please tell me the best way to connect that

How To Design 3-column Data Report With Data Environment
Anybody please help me to design 3-column data report with data environment as there is code available for "how to make 2-column data report without data environent".


How To Generate Data Report Without Using Data Environment Designer
Is there any way to generate Data report without using Data Environment Designer from VB Codes. The report must contain Records from more than 2 tables. Say for Example : SalesMaster & Sales Detail table. Again SalesMaster table must have some relationship with the Customer table. Where CustomerID is the link between the SalesMaster & Customer table.

Thanks in advance

Data Report & Data Environment (posted From Sweden)
I'm working with a program for a company and I have some trouble with the data report and its connection to a data environment. I use the same data report for two different kind of results. The problem is that when i switch between these report I open the database that is connected to the data environment and fill it with my result. After that i just make a refresh on the report but it contains its old data? If i break before the refresh I can see that the access database contains the data right data. I have also tried to requery the database environment but for no use! Sometimes though this method works? Anyone who has a tip of some kind ?


Data Report And Data Environment Querys Or SQL?!
I have created an interface that allows me to enter, display, modify data in my Access database. I can now use a SQL statement on my ADOs to display info in my DBase taht matches info on my form only...

Now I want to print that info on a report. I am using the built in Data report that VB has. I can print my report no problem, but I can't get the SQL part working. I want to print, or query info in my table, according to what I select on my form...Heres my statement (Same statement that I use in my working ADO, but doesnt work for reporting)

Select * from Timesheets Where [employee name] = '" & strNamePrint & "' and (Date >= '" & strFrom & "' and Date <= '" & StrTo & "')

The strings are defined according to values on my form.

This is killing me!!

Any advice would be greatly appreciated.

Need Help On Project [Data Report + Data Environment]
hey guys,

i'm making a project that will show daily sales report on a Data Report. I've already made it but i want the data to be displayed in the report to be dynamic, like i can specify to show data only for a specific date. I'm new to using Data Report and Data Environment that's why i need your help on this. i'm attaching my project right here so you can check it out. all help will be grealy appreciated. thanks in advance

Data Environment/data Report Problem
When I try to change my commandtext programmatically, it's not working.

1 I created a command object with a sql statement (called deCommand1)

2 I also created a data report with the data source being deCommand1

3 In my program, I changed the sql statement and stored it in a string call

4 In my program I put this command:
= strSQL

When I had two commands, this was working. When I deleted a command and
moved the above command became command1, it stopped working. What am I
doing wrong?


Step To Add Data Environment And Data Report
step to add data environment and data report ...?

How To Put Images On VB6 Data Report Without The Data Environment
I am still learning Visual Basic 6, I have just learnt how to use reports using the data environment, but I wonder how can one use the data report without using the data environment, especially how to insert images stored in a database or whose path is stored in the database to that data report.

Of great importance I need a detailed explanation of how to manipulate the data report sections using the VB6 code without the data environment and probably major controls of the data report

VB Data Report Groups Without Data Environment
Hi All,

I have a MySQL Backend and accessing it from my VB app via ADO.

Data access is working fine. I have created reports already with VB Data Report without using Data Environment.

I would like to enhance my reports by grouping the data, something like this:

DATE (Group Header)


                                                    TOTAL (Group Footer)




Does anyone out here have any links or pointers as to how to go about creating the grouped report using data report without data environment.

In a post here, it said about using the SHAPE command, could anyone point me as to what component or reference do i have to include in VB to use the shape command.

Any help would be greatly appreciated. Thank You.

Junben Bajuyo
System Administrator
Ciudad Medical Zamboanga
Zamboanga City, Philippines

Data Report With Parameters And Data Environment
Anyone PLEASE help! I am desparately trying to figure out how to generate a report (using VB report designer and Data environment) where the user will be promted for a start and end date and then be shown a report with transactions within those dates.

So far I have a query in the DE that has >=? in the date field (with "StartDate" as the alias), and <=? in another date line (with "EndDate" as the alias). I changed the parameter type to date. Can you not have 2 parameters on the same field?

When I run it, I get an error..."argument not optional". I tried making the parameters "optional" set to False, but I get the same error. When I get rid of the second parameter, it works just fine, but I need to see all records between 2 dates.

ANY suggestions would be greatly appreciated!!!


Data Report/Data Environment Won't Display Last Row.
Hi, I have had this problem before and another vbcity user has also asked this question, but I can't find their question and mine wasn't answered so here it is.

If my table has 2 rows, only 1 is displayed. If the table only has 1 row, nothing is displayed. ie my last row is never displayed. Any ideas? It works fine in access. Every row shows up.

Thanks in advance.


Data Report Trouble Without Using The Data Environment
Hi All

Having experienced problems using a UDL file as a connection source for a Data Environment I decided to scrap that and code the Data Report by following Deke's FAQ ( which is very good ). I managed to get that to work no problems. When I tried to follow the same steps but on my own database I got the following error: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.

This is my shape statement:

    ReportSQL = "SHAPE { "
    ReportSQL = ReportSQL & "SELECT Company_Info.*, Customer_Info.* "
    ReportSQL = ReportSQL & "FROM Company_Info, Customer_Info "
    ReportSQL = ReportSQL & "WHERE Company_Info.Company_ID = Customer_Info.Company_ID and Customer_Info.Customer_ID = " & CustID & " } "
    ReportSQL = ReportSQL & "AS Command1 "
    ReportSQL = ReportSQL & "APPEND (( "
    ReportSQL = ReportSQL & "SHAPE { "
    ReportSQL = ReportSQL & "SELECT * FROM Order_Info} "
    ReportSQL = ReportSQL & "AS Command2 "
    ReportSQL = ReportSQL & "APPEND ({Select * From Product_Info} "
    ReportSQL = ReportSQL & "AS Command3 "
    ReportSQL = ReportSQL & "RELATE 'Order_ID' TO 'Order_ID') "
    ReportSQL = ReportSQL & "AS Command3) "
    ReportSQL = ReportSQL & "AS Command2 "
    ReportSQL = ReportSQL & "RELATE 'Customer_ID' TO 'Customer_ID') "
    ReportSQL = ReportSQL & "AS Command2 "

This is the first time I have used this so any help would be appreciated as it is really driving me up the wall now



VB Data Environment - Data Report Problem.
I want to print a report using de-dr in vb6 (from ms access). When I did this for the first time it worked perfectly, but if I want to run it again (to choose another date range for example) I got Run-time error '3705': The operation requested by the application is not allowed if the object is open. Please help.

Thanks very much.

Data Report Without Data Environment

Is possible to use data report without use data environment?
It seems to me that data environment functions as a "tier" to bound data report to the data. But, in fact, I want to query the table with a SQL command and get the result to a recordset, then populate the report by myself (as well I would doing that in a flexgrid, for instances).

Is it possible?


Data Report && Data Environment
I have set up a data report with some SQL code in it.
The code works OK when tested in Access, but I get a "Datafield 'Styles.CustomerName' not found" message when run in Visual Basic. My SQL code is setout below. Styles is my command name.

SELECT Garment.*, Customers.CustomerName, Garment.ID
FROM Customers INNER JOIN Garment ON Customers.CustomerCode = Garment.CustomerCode
WHERE Garment.ID=[?];

Can any one give me some idea where I am going wrong?

Data Environment && Data Report
I use my project i have data environment and data report.
when i change the commands in the data environment (using Commandtext property) during run time data report doesnt changes due to command.
What should i do?

Data Environment && Data Report Help Please
i need to view salary payslip (data report) based on that particular month and year.

in Data Environment sql :

SELECT[emp_id], [emp_name], [emp_position], [emp_bs], [month_paid], [year_paid], [total_addition], [gross_pay], [total_deduction], [total_pay] FROM salary WHERE month_paid = ? and year_paid = ?

parameter is monthler

parameter is yearler

in vb code:


Dim intMonth As Integer
Dim intYear As Integer

' is a combo box that select month

If cboMonth.ListIndex = 0 Then
intMonth = 1
ElseIf cboMonth.ListIndex = 1 Then
intMonth = 2
ElseIf cboMonth.ListIndex = 2 Then
intMonth = 3
ElseIf cboMonth.ListIndex = 3 Then
intMonth = 4
ElseIf cboMonth.ListIndex = 4 Then
intMonth = 5
ElseIf cboMonth.ListIndex = 5 Then
intMonth = 6
ElseIf cboMonth.ListIndex = 6 Then
intMonth = 7
ElseIf cboMonth.ListIndex = 7 Then
intMonth = 8
ElseIf cboMonth.ListIndex = 8 Then
intMonth = 9
ElseIf cboMonth.ListIndex = 9 Then
intMonth = 10
ElseIf cboMonth.ListIndex = 10 Then
intMonth = 11
ElseIf cboMonth.ListIndex = 11 Then
intMonth = 12
End If

is a combo box that select year

If cboYear.ListIndex = 0 Then
intYear = 2007
ElseIf cboYear.ListIndex = 1 Then
intYear = 2008
ElseIf cboYear.ListIndex = 2 Then
intYear = 2009
ElseIf cboYear.ListIndex = 3 Then
intYear = 2010
ElseIf cboYear.ListIndex = 4 Then
intYear = 2011
End If

' how should i pass a value to a Data Environment sql query ?
or got other way to do ?
' i need view that month and year that i have selected.

Data Environment/data Report HELP!
dear all,

I am having problems opening a file containing dataEnvironment/datareports the problem is I cannot open the data environment
this error was generated can neone help?

Line 2: Class {C0E45035-5775-11D0-B388-00A0C9055D8E} of control DataEnvironment1 was not a loaded control class.
Line 0: The file C:Documents and SettingsuserMy DocumentsNew FolderDataEnvironment1.Dsr could not be loaded.

as I am still a novice to VB please explain throughly.


Data Report With No Data Environment
Hi there,

I want to use data reports for just printing input data by a user on a form. No database table is involved.

It looks like data reports is forcing me to set the data source.

Does anybody know how to use data reports without setting the datasource.


Help With Data Environment And Data Report
Hi, I need some help with my Data Enviroments.. I set up a DataEnviroment and linked it to a data report to print invoices.. I set up the command and a child command and inserted some SQL statements and put the proper text boxes on the datareport.. But the invoices will be changing every time I print a report, so in my VB application, I go:

dataEnvInvoice.Commands("Invoice").CommandText = "SHAPE (SELECT ...)"

And my report displays fine... Then, when a different report have to be printed, I set the command text again and it doesn't change.. The same information is display from the last invoice.. Can I only set the command set once ever session? Is there a way for me to reset the command text so everything I print an invoice with different criteria, it'll work perperly?

Data Report With Data Environment
Dear Friends,

I am using Data Report in Visual Basic 6.0, it is working fine on the developer pc. When I am going to install the setup for that system on the other pc, then Data Report is not beeing open. Other things are working fine. The system asks for the provider,user,password and data source at the time of opening any data report from the system.

Please tell me, which are support files, I have to take at the time of package creation for running Data Report smoothly.

Keyur Sheth

Data Environment/Data Report
Hi, I have an application in VB6 and SQL 2005. I have multiple databases with different names user id's and passwords. I'm want to create a report using DataReport, DataEnvironment that give me a list of products break by store number (each database has multiple stores). I want the report to run from one Database at a time, I don't want to relate the data to other databases. I create using the data environment, data report wizard a report and it works great, my problem is that I want to be able to pass the database name I want the report from, and when I use the DataEnvironment Wizard I have to specify the database name. I'm almost pretty sure, there is a way to pass the database's name through code but I don't know where. I have a DataEnvironment1 with a DEconnection = Inventory, DeCommand= Stores and Items. I also have a Datareport1.

Thanks for the help

Silmary Cedeno
Universal Data Consultants, Inc.

DATA Environment & Data Report
I am using Data Report with Data Environment in the project of PAYROLL. In this i want to show a Page Total in each of page. But there is no provision of Page Total in Data Report.
Please anybody can help me.


VB Data Report And Data Environment
In one part of an app I'm developing I need to print an Invoice.  I'm pulling the information from 2 tables in an Access database (Invoice and InvoicelineItem).  I have command objects in a data environment set up for these tables and they are grouped correctly.  My data report's data member property is set to the data environment.  

When I run the report it displays the Invoice number, date, company info etc. in the group header and then the invoice line items for that particular invoice number in the detail section.  It then continues and does the same for every invoice number in the table - looks great.  

My problem is that in the real application I only want the report to show info for a particular invoice that is choosen by the user.  How can I set a field value in the data environment's recordset before the report is called??

Data Environment And Data Report
hi guys. im a newbie here and in vb. i just want to ask some question. im creating a project and i want to display a report base on the date that given. from a certain time to another time (ex. june1-june 30,2005). the user will input the date he/she desired to see... how can i display this report? help guys.. tnx

Data Report Without Data Environment??
Hi Friends

can I design data report withoiut data environment or Can i design report without assigning any command. Actually my data report is based on query and I don;'t need to assign any command but than it gives me error that invalid data source.??

wagt to do>>

PRatik mehta

Data Environment, Data Report And SQL
I am having a table in access which contains the fields- id, title, price. I am using a query for the command object in the data environment which is like this "Select count(*), sum(price) from table1 where id=? group by price. This query is working fine and when i connect this to data report it displays the report correctly. But i would also like to have the 'title' field value and 'id ' field value from the table on to the data report in the header section. But obviously the query does not permit to select these as I am using the aggregate functions. Is there any way to have these field values on the report?

Thanks very much

Data Environment && Data Report
I want to use the value that comes from a textbox on a form, in the where clause of the sql statement I am using for the command object in a data environment. is it possible?

Many thanks

Data Environment And Data Report
I have a project that includes a data environment (denvHUN) and some data reports (drptReqDtl and drptReqSum for example).

There are times when I would like to display some text (other than the actual value of a field) in one of these reports based on the actual value of that field.

For example I am including the status of the record on the report. But the status is stored in the file as a single letter.
(A = active, R = rejected, X=cancelled etc.)

Is there a way to access the field in the record set that is returned when the data environment is instantiated so that I can display some text rather than the value of the field.

The data source for the report is denvHUN and the data member is cmdReq.
The data member for the field on the data report (txtfldStatus) is cmdReq and the data field is fldStatus.

My report is generated when the user clicks on the appropriate command button from the menu.

For example the following code is associated with the click event for "View Request Detail"
Private Sub cmdPrtReqDtl_Click()
   'display the Request detail
   ' You must close the recordset before changing the parameter.
   If denvHUN.rscmdReq.State = adStateOpen Then
   End If
   'Reopen data environment with current value of parameter
   denvHUN.cmdReq (gstrUserID)
   If denvHUN.rscmdReq.EOF Then
      MsgBox "No records matched that query."
   End If

End Sub

I really don't understand how to access fields or where to write code for the actual data report or the data environment.

I realize that it may not be possible to do what I am trying to do. if this is the case we will just have to live with it, but I am not sure our users will always understand the one letter code, and I would prefer to use the extended value.

Data Report Without Data Environment
hi guys.. can someone help me. how can i use the data report without the data environment. i've seen an example of this but i dont know what to do. how can i put the fields of my database to the data report?
here is the code that i got.

Private Sub cmdShowReport_Click()
Set rs = db.Execute("select *from student")
If rs.EOF = False Then
Set DRSample.DataSource = rs
End If
End Sub

Data Environment And Data Report
Hi! I am using a Data Environment to fill a Data Report with the fields I need. When I choose a field in a combo box to activate the SQL query connected to the command (with that field as the main field) the data in the data report is updated when using the text controls. But when trying to do the following:

dsrTest.rscmdReceipt_Details.Fields!(any field)

in the program code, the fields remain the same as for the first item chosen in the combo box. (i.e. when I change the , e.g. car number to get the new fields through code, they remain the same as for the first car number. But through the text controls in the Data Report they change. I cannot understand why they change through the Data Report, and not through code)

Thanks very much

Data Report And Data Environment
If I use a Data Report and Data Environment .I get an error
"Failed getting rowset from the current row set"
Is it a common type of error that can be avoided or is there any other way to make reports other than using data environment.
Thankyou for yr time .

Data Environment && Data Report
Any one familiar with Data Environment and Data Report in VB 6.0 If so email me I have a question for you.

Data Report And Data Environment
I was just wondering if it is possible to use Data Report without Data Environment i-e by using code.
Thankx in Advance

Data Environment And Data Report In VB6. Please Help!!!
I want to print a report using de-dr in vb6 (from ms access). When I did this for the first time it worked perfectly, but if I want to run it again (to choose another date range for example) I got Run-time error '3705':
The operation requested by the application is not allowed if the object is open.

This is the line where I got the error.

deCustomer.Classification_Grouping Date1.Text, Date2.Text, ""

I use an SQL Statement to select the source data.

SELECT * FROM Table WHERE ([Date] between ? and ?) AND Status&lt;&gt;?

I have 3 param: date1, date2 and status. I also make a group by Classification.

Thanks very much.

Data Environment/Data Report
Hi All,

On the development machine the data report is showing alright. But on the on another PC an error comes up "Report width is larger than the paper width.".

Both PC uses the same printer and have the same printer settings and getting that error. Imagine what would happen if I distribute the program.

Could you please tell me what has to be done to avoid this.

Many Thanks

@|o o|@
.| _ |.

Data Environment Report Cannot Be Changed Once Report Has Been Opened...
i use a data environment like this:


deLexDB.Commands("fullStockList").CommandText = strSQL

full stock list is a prepared command with an empty command. i then open the report like this:


drptFullStock.Sections("Section1").Controls("txtItemMinQty").ForeColor = MIN_MAX_COLOURS(chosenColourScheme)
drptFullStock.Sections("Section1").Controls("txtItemMaxQty").ForeColor = MIN_MAX_COLOURS(chosenColourScheme)
drptFullStock.Sections("Section1").Controls("txtItemMinQty").Alignment = MIN_MAX_ALIGNS(chosenColourScheme)
drptFullStock.Sections("Section1").Controls("txtItemMaxQty").Alignment = MIN_MAX_ALIGNS(chosenColourScheme)
drptFullStock.Sections("Section1").Controls("Line1").BorderColor = MIN_MAX_LINE_COLOURS(chosenColourScheme)
drptFullStock.Sections("Section1").Controls("Line2").BorderColor = MIN_MAX_LINE_COLOURS(chosenColourScheme)

drptFullStock.Top = 10 * X
drptFullStock.Left = 10 * Y
drptFullStock.WIDTH = Screen.WIDTH - 2 * 10 * X
drptFullStock.HEIGHT = visY - (2 * 10 * Y)

drptFullStock.Orientation = rptOrientLandscape
drptFullStock.Show vbModal, Me
fullStockHasRun = True

the first few lines jsut set up some aspect of the report; sometimes things on the report appear in grey if the report is being used for a stocktake, or black if it is being used as a report of the declared levels

you will note there is a boolean on the last line, that becomes true after the report has been shown once. i use this boolean to say "Sorry, you cant change the report options without restarting the program"

how lame is that?

well anyways, the question is why can i not change the .CommandText to a different strSQL and show things in a different order, etc? how do i change the query that generates the report, without quitting the app ?

Data Report/Environment

I have a project.. And I want to create a data report to it.. (within the same project)
How would I invoke it?

Thanks in advance...

Report With Data Environment
I have created a report using the data environment. I have the data environment grouped on user name, with a subgroup on date. My report works great, it displays data in the correct sections. Now I would like to create a form that accepts user input (a range of dates) that will then pass those variable to the data environment and generate a report based on the dates that the user entered.

When I try to use variables in the criteria field in the SQL builder, it does not work. If I put quotes around the variable, I get a data type mismatch error, if I don't put quotes (double or single) then I get a different error.

Is what I want to do even possible?


Data-Report & Environment
I am having a database in Ms-Access, one table named MST another is TRN. Now i want to preparre a statement which will contain only 1 entry from the MST table and rest from the TRN, based on a condition. The record taken out from MST must be first in statement. I want to use VB DATA REPORT to view/print this statement. How can i do it, because as far as i know data report's data source must be data-environment. Can i merge

Copyright 2005-08, All rights reserved