Change control source

FuzMic

DataBase Tinker
Local time
, 07:38
Joined
Sep 13, 2006
Messages
739
Hi guys

I want to change the ControlSource of a field in a report during opening of it but is not allowed in printPreview or after it is started.

How to work around this? Help please.
 
Could you use an IIf() statement in the ControlSource or query column instead? Just a thought...
 
what event did you attempt this in? Might have been the wrong one as I believe it's possible from Open event.
 
It is done in open event, not much event choice, other is activate in which the same forbid
Iif not possible as i am relying on openargs to flag change
Thanks for trying
 
Iif not possible as i am relying on openargs to flag change
Thanks for trying
Are you sure? Have you tried? What happens if in the ControlSource you entered something like?
Code:
=[OpenArgs]
 
maybe you should post calling code and open event code or a copy of db as I think it should work; or be certain that openArgs contains a value first.
 
I would be surprised if you could change the control source after the report has assembled all the data.

Why do you need to do this? What is your circumstance?
 
I would be surprised if you could change the control source after the report has assembled all the data.
That's just it. On Open, it has not done so.
as designed
rptCtlSrce0.jpg


as modified on open
rptCtlSrce1.jpg


It's not my report, btw. The db is from some other thread.
 
Does anyone know what code is being used to change the source? Is the OP trying ot use a different field in the source query, or something else?

One way to do it would be to have a completely different source query, with the same field names, rather than change the source.

setting me.recordsource = "different query" will work in the open event.

I use this in reports to produce the same report, but with a slightly different query.

eg.
-select delivered dates, or invoiced dates
-select one branch or all branches
 
Does anyone know what code is being used to change the source?
You mean with respect to the pics I posted?


Me.RequestName.ControlSource = "=[DsID]"
 
What is the purpose of showing a different value in "requestname"?

Could the OP not leave the control unbound, and just look it up from the tables at runtime in the detail print/format event, based on other data in the report?
 
What is the purpose of showing a different value in "requestname"?
There is no point to that. It is a hack on a report in response to
I would be surprised if you could change the control source after the report has assembled all the data.
to which I replied with proof that control source can be modified on open. Don't try to rationalize the sense of what I posted from a data point of view. The message is just that it can be done in Open event.
 
THANK YOU for all responses

As Macron rightly post, CHANGE of rowsource is possible.

SORRY i made the mistake of setting a sub report from main report & later make further settings in sub report.
Access already open sub report so further setting off sub is forbidden

A timing issie
 
@micron.

ah. OK - I thought you were talking about the specific issue, not in general terms. It's all sorted now, obviously.
 

Users who are viewing this thread

Back
Top Bottom