472,351 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,351 software developers and data experts.

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 21776
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jayjay | last post by:
I've got a report that has a series of unbound text boxes that are being populated by some variables in code. The format is supposed to be a...
4
by: N. Graves | last post by:
Hello, Please help me I'm still a newbie. I have an unbound text box on a report that I would like to build a expression to display it on the...
6
by: david | last post by:
I try to use "for" loop to retrieve and assign values in web form. The code is in the following. But it can not be compiled. What I want to do is:...
5
by: Eric | last post by:
I try to to set the value of a text box through code and it will always display the same value in every record. I think i cant display a recordset...
1
by: Patonar | last post by:
Hi, I have a report that is calculating subtotals - however sometimes there is no data to show.... so the subtotal field will be blank. Is there...
5
by: jamesnkk | last post by:
I have an unbound text - txtfreight on a Subform, when I enter a value , it does not save to the Main form table immediately, unless I close and open...
1
by: AccessHunter | last post by:
Hi, I have an access report whose control source is a table. The report is opened via vba code.There is also an unbound text box (named -...
11
by: jwessner | last post by:
I have a form (Form1) which contains basic Project data and a subform listing the personnel assigned to the Project as a continuous form. Selecting...
2
topher23
by: topher23 | last post by:
Disclaimer: I've already come up with a solution for this issue, but I thought I'd post it in the hope that it could help someone else and on the off...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.