Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating Data Report

Status
Not open for further replies.

chrisgarvey

Technical User
Mar 27, 2003
64
0
0
GB
I have a form with a data control linked to a Access D.B. This allows users to create/update/delete the DB.

From this form I have created a Data Enviroment that generates a data Report.

The data report produces the report fine, If add/update/delete a record once and then re-run the report, it updates as required.

Although if I try and create/update/delete more than once it does not update the report accordingly.

I have played with refreshing the data enviroment, data report, recordset although this appears not to solve the problem.

Any help really would be appreciated.

Chris.
 
The most reliable way I have found is to close the DataEnvironment connection and re-open with the new query data fed into your Command object:

dr1.Hide
With DataEnvironment1
If .Connection2.State <> 0 Then .Connection1.Close
.Connection1.Open
.Command1 (strParam1)
End With
dr1.Show

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Thanks for your input johnwm.

I understand your proposed solution of closing the recordset & report and then re-opening to refresh the report.

However I am struggling to understand the code;
what does '.connection2' & '.connection1' refer to?

Is this the data enviroment??

I only currently have one data enviroment.

What does '.command1' refer to?

I have spent several hours trying to figure this out, but am still clue-less. Is it possible for you to explain your code in a little more detail.

Chris.
 
Sorry, my bad editing skills!
Connection1 is the name of the Connection object in the DE I'm using. All references to Connection should read Connection1 (or whatever name you've called your connections)

The .Command1 is the Command object of the DE.Connection that contains your query

Is it the use of the :
[tt]With DataEnvironment1
.
.
End With[/tt]
construction that you're querying? That simply sets a reference to the DataEnvironment1. Any use of :
[tt].Connection1 [/tt]then refers to DataEnvironment1.Connection1

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
I am still struggling to get the code disucssed earlier in the thread to work.

When I run the code as shown below I get:

Run-Time error '438'
object doesn't support this property or method

My recordset is definetly called datJewellery.

Any ideas?

Private Sub cmdReport_Click()
'Click on button to open Jewellery Report

datJewellery.Recordset.Hide
With DataEnvironment1
If Jewellery.Connection2.State <> 0 Then Jewellery.Connection1.Close
Jewellery.Connection1.Open
JewelleryItems.Command1 (strParam1)
End With
datJewellery.Recordset.Show
rptJewelleryReport.Show
End Sub
 
You've still got a .Connection2 which should be 1

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top