Changing recordsource (1 Viewer)

John thomas

Registered User.
Local time
Yesterday, 18:10
Joined
Sep 4, 2012
Messages
206
Hi
I have a report that thats record souce is from a query run from a form
I want to use the same report but run it from a different form using a a differnet query
How do i automatically change the record souce when the report is opened from my new form

code
Private Sub Report_Current()
If Forms![Vew all Invoices]![OrdID] > "1" Then
Me.RecordSource = copyofinv2
End If
End Sub

When I run the report from my new form i go to the original recordsouce .It dosnt change it in the proerty sheet
 

spikepl

Eledittingent Beliped
Local time
Today, 03:10
Joined
Nov 3, 2010
Messages
6,142
Current event is too late. Use Open.
 

John thomas

Registered User.
Local time
Yesterday, 18:10
Joined
Sep 4, 2012
Messages
206
Hi thats done the trick .
But I have a qustion
Although I know it has changed the record souce .Becouse it all works . If I open the property sheet and look at the rocordsouce it shows the original record souce .I would have expected to see the new record souce in the proerty sheet
 

spikepl

Eledittingent Beliped
Local time
Today, 03:10
Joined
Nov 3, 2010
Messages
6,142
Because when you open it you are entering the design mode, so it shows you what has been saved as design. If runtime changes got saved that would make a mess.
 

Users who are viewing this thread

Top Bottom