From VBA to Text Box

gpeirce

Registered User.
Local time
Yesterday, 22:00
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.
 
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?
 
You do it in code:
For intA a sample below.
Code:
Me.YourTextCotrolName = intA
 
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

Back
Top Bottom