vwgolfman
06-27-2008, 09:48 AM
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.
pbaldy
06-27-2008, 10:01 AM
Try
Me.TexboxName.ControlSource = "='your text here'"
KenHigg
06-27-2008, 10:10 AM
-or-
Me.TexboxName.ControlSource = InputBox("Enter report text:")
???
vwgolfman
06-27-2008, 10:21 AM
Hmm,
Neither of these work guys.
When the report is called, it pops up a window asking for input.
KenHigg
06-27-2008, 10:23 AM
That's were you put in the text you want in the text box on the report. Try it.
vwgolfman
06-27-2008, 10:25 AM
I want to specify the text in the Report_Open method Ken.
KenHigg
06-27-2008, 10:27 AM
Do you want to type in the text each time the report opens?
pbaldy
06-27-2008, 10:28 AM
Define "doesn't work". I tested this and it worked fine:
Private Sub Report_Open(Cancel As Integer)
Me.Text17.ControlSource = "='test text'"
End Sub
vwgolfman
06-27-2008, 10:32 AM
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 :)
KenHigg
06-27-2008, 10:40 AM
Oh then yeah, Pauls is the one. Sorry, I mis-understood what you were trying to do - :)
vwgolfman
06-27-2008, 10:50 AM
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?
pbaldy
06-27-2008, 11:09 AM
Presuming it's the first value:
Me.ComboName = Me.ComboName.ItemData(0)
vwgolfman
06-27-2008, 11:14 AM
Woohoo!
Thanks Paul, that's the business :)