469,328 Members | 1,265 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

How to assign values to Unbound Text box in Report thru VBA code ?

I have a report with some Unbound text boxes. I want to shows the values in
these text boxes from my VBA code. How can I assign the valuse thru code ?
Pls help me.

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #1
7 21269
rkc
Paul via AccessMonster.com wrote:
I have a report with some Unbound text boxes. I want to shows the values in
these text boxes from my VBA code. How can I assign the valuse thru code ?
Pls help me.


Assign values to the textbox controls in the report's
Detail_Format event.
Nov 13 '05 #2
Create a Public Function that returns the string you want to appear in
the text box.

eg.
Public Function MyFunction() As String
MyFunction="The Iraq War is illegal and immoral."
End Function

Set the ControlSource of the TextBox to
=MyFunction()

Nov 13 '05 #3
rkc
ly******@yahoo.ca wrote:
Public Function MyFunction() As String
MyFunction="The Iraq War is illegal and immoral."
End Function


I get a compiler error when I try this.
Nov 13 '05 #4
I don't know what to say. I have been using this kind of assignment for
a long time, back to Access 95. At that time I had an extensive charity
receipt/thanks writing report which selected text depending on type of
membership, type of donation etc.

I just double checked in Access 2002 and up pops:

The Iraq War is illegal and immoral.

Could it be God speaking, and not the report at all?

Nov 13 '05 #5
ly******@yahoo.ca wrote:
: Create a Public Function that returns the string you want to appear in
: the text box.

: eg.
: Public Function MyFunction() As String
: MyFunction="The Iraq War is illegal and immoral."
: End Function

: Set the ControlSource of the TextBox to
: =MyFunction()

How do you adapt this for the array needed by a combobox?
thanks, --thelma
Nov 13 '05 #6
rkc
ly******@yahoo.ca wrote:
I don't know what to say.


It was comedy my friend from the north.
Nov 13 '05 #7
A Combo Box's value should be able to be set just like a that of a
TextBox.

For my preferred way to set a ComboBox's list in code see
http://groups.google.ca/group/comp.d...d80edcea8a1598
and the two immediate children of that post.
Other developers will have other preferred ways.

Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jayjay | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Purva khokhar | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.