How to replace textbox's control source with hard-coded text?

vwgolfman

Registered User.
Local time
Today, 06:39
Joined
May 26, 2008
Messages
35
Hi,

In a report I have a textbox which displays the value of a field (its control source).

Under certain conditions I would like to remove the "binding" for that textbox and replace the displayed text with something specified by myself.

I intend to use the report's Report_Open method in which to do this.

Please can I have some guidance?

Thank you.
 
Try

Me.TexboxName.ControlSource = "='your text here'"
 
-or-

Me.TexboxName.ControlSource = InputBox("Enter report text:")

???
 
Hmm,

Neither of these work guys.
When the report is called, it pops up a window asking for input.
 
That's were you put in the text you want in the text box on the report. Try it.
 
I want to specify the text in the Report_Open method Ken.
 
Do you want to type in the text each time the report opens?
 
Define "doesn't work". I tested this and it worked fine:

Code:
Private Sub Report_Open(Cancel As Integer)
  Me.Text17.ControlSource = "='test text'"
End Sub
 
I'm sorry Paul I must have made a typo.

Yes it works fabulously thank you!

Thank you to you too Ken.

No, I didn't want to have to type the text in each time the report opens :)
 
Oh then yeah, Pauls is the one. Sorry, I mis-understood what you were trying to do - :)
 
Another quick one guys (on another topic)....

I am adding "All" to the choices in a ComboBox by using the following SQL....

SELECT BusinessModel, BusinessModel FROM tblBusinessModels UNION SELECT '*', '(All)' FROM tblBusinessModels;

Column 1 is the bound column and I am giving it width of 0.
It returns * or the BusinessModel enabling my query which works on this value to perform correctly.

What I wish to do is make * (or "All") the DEFAULT value in the ComboBox.
I can't add it to the "Default Value" property for the control because it's not strictly in the list of values returned from the BusinessModel field.

Any ideas please?
 
Presuming it's the first value:

Me.ComboName = Me.ComboName.ItemData(0)
 

Users who are viewing this thread

Back
Top Bottom