From VBA to Text Box (1 Viewer)

gpeirce

Registered User.
Local time
Today, 06:50
Joined
Sep 24, 2015
Messages
23
I posted before but things got too confusing. I have some variables coded in a VBA module. The results are in fields called intA, intB and intC.

I also have 3 texts boxes in a form. How do I code the text boxes so I can display intA, intB and intC? Do I put something in the control source? Do I name the box in a certain way? Do I put some code in like me.intA.value = something or other??

An accdb example would be nice too, if you have it.

Thank you.
 

gpeirce

Registered User.
Local time
Today, 06:50
Joined
Sep 24, 2015
Messages
23
Do you mean fields in a table?

No, these are just variables, such as:

Dim intA as Integer
Dim intB as Integer

What do I put in the text box properties to display them?
 

JHB

Have been here a while
Local time
Today, 15:50
Joined
Jun 17, 2012
Messages
7,732
You do it in code:
For intA a sample below.
Code:
Me.YourTextCotrolName = intA
 

smig

Registered User.
Local time
Today, 16:50
Joined
Nov 25, 2009
Messages
2,209
I think you are confusing the terms.
Fields are only in tables.

Make these variables as Public variables.
Risk is they might change somewhere on the way to your text box.

In your form's OnOpen event you can put:
MyForm.MyTextBox = intA

If these variables are a result of a function you better use:
MyForm.MyTextBox = fnMyintAFunction()

or simply put = fnMyintAFunction() as the rowsource for your textBox
 

Users who are viewing this thread

Top Bottom