How to refresh data on a VB 6.0 Data Report 
Author Message
 How to refresh data on a VB 6.0 Data Report

I have a report designed with VB 6.0 Data Report. This report takes its
input from a Command in the Data Environmet that executes a Select query in
an Access 97 database. I run the report from a form in an MDI environment. I
have another form that changes the table in the Access database that feeds
the report. What happens is that whenever I add or delete a record in the
table using the latter form, the report needs to be run twice to see the
changes. In other words, 1) you run the report and see record X, 2) you
delete record X and run the report again, 3) the record is still on the
report, 4) you run the report again and now the record is gone. The same
thing happens for additions to the table. What could be happening? A piece
of the code follows.

'In what follows:
'dePayrollP is de DataEnvironment
'cmdEmployeesP is the command that feeds the report
'rscmdEmployeesP is the recordset underlying the command
'rptEmployeesP is the report.

'To see the changes, you have to go twice through the following code.

If dePayrollP.rscmdEmployees.State = adStateClosed Then
    dePayrollP.rscmdEmployees.Open
End If
dePayrollP.rscmdEmployees.Requery
Set rptEmployeesP.DataSource = dePayrollP 'I think I'm rebinding here
dePayrollP.rscmdEmployees.Close 'This statement makes no difference
rptEmployeesP.Show

---Alberto.



Thu, 07 Feb 2002 03:00:00 GMT  
 How to refresh data on a VB 6.0 Data Report
I ran into a similar problem and throwing a Refresh in before the show
worked for me.  Try

rptEmployeesP.Refresh

right before the show.



Quote:
> I have a report designed with VB 6.0 Data Report. This report takes
its
> input from a Command in the Data Environmet that executes a Select
query in
> an Access 97 database. I run the report from a form in an MDI
environment. I
> have another form that changes the table in the Access database that
feeds
> the report. What happens is that whenever I add or delete a record in
the
> table using the latter form, the report needs to be run twice to see
the
> changes. In other words, 1) you run the report and see record X, 2)
you
> delete record X and run the report again, 3) the record is still on
the
> report, 4) you run the report again and now the record is gone. The
same
> thing happens for additions to the table. What could be happening? A
piece
> of the code follows.

> 'In what follows:
> 'dePayrollP is de DataEnvironment
> 'cmdEmployeesP is the command that feeds the report
> 'rscmdEmployeesP is the recordset underlying the command
> 'rptEmployeesP is the report.

> 'To see the changes, you have to go twice through the following code.

> If dePayrollP.rscmdEmployees.State = adStateClosed Then
>     dePayrollP.rscmdEmployees.Open
> End If
> dePayrollP.rscmdEmployees.Requery
> Set rptEmployeesP.DataSource = dePayrollP 'I think I'm rebinding here
> dePayrollP.rscmdEmployees.Close 'This statement makes no difference
> rptEmployeesP.Show

> ---Alberto.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


Sat, 09 Feb 2002 03:00:00 GMT  
 How to refresh data on a VB 6.0 Data Report
I did just what you said, but it didn't work. I add a record with certain
key, delete it, add it again with the same key, delete it again and so on
and on. The first couple of times the report shows the changes correctly,
but from there on you have to run it twice to see the changes. Maybe in your
case it doesn't work either and you just didn't go through the process
several times to see it.
Thanks for your help.
---Alberto.


Thu, 14 Feb 2002 03:00:00 GMT  
 How to refresh data on a VB 6.0 Data Report

Quote:
>I have a report designed with VB 6.0 Data Report. This report takes its
>input from a Command in the Data Environmet that executes a Select query in
>an Access 97 database. I run the report from a form in an MDI environment.
I
>have another form that changes the table in the Access database that feeds
>the report. What happens is that whenever I add or delete a record in the
>table using the latter form, the report needs to be run twice to see the
>changes. In other words, 1) you run the report and see record X, 2) you
>delete record X and run the report again, 3) the record is still on the
>report, 4) you run the report again and now the record is gone. The same
>thing happens for additions to the table. What could be happening? A piece
>of the code follows.

Try using the timer to slow down the time between the database change and
the display of the report. I've been having the same problem and this fixed
it.

Let me know if this works!

Chuck.



Tue, 19 Feb 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. MNS VB 6.0 Data Environment and Data Report Run time problem

2. How to refresh data in Crystal Reports 6.0

3. CRW 6.0: no refresh of data when generating report

4. Data Refresh Problem in Data Report

5. Why data report don't refresh the data

6. Data Report Refresh (not refreshing)

7. Crystal Reports: Refreshing Data from VB?

8. Refresh data of Crystal Report from VB

9. Refresh Report Data function in VB Code

10. Refreshing Report Data Through VB

11. Data Report VB 6.0

12. VB 6.0 and Data Report

 

 
Powered by phpBB® Forum Software