How to display the value of a variable set by VBA on a report?

I have VBA code that grabs a customer name and assigns it to a variable called Cus. How do you display the variable on an Access report?
LVL 1
JeffDeveloperAsked:
Who is Participating?
 
JeffDeveloperAuthor Commented:
Resolved:

In your VBA code set the variable you're attempting to collect as Public (placed above your function) and complete your function. Create a new function in the same module calling for your variable:

Public Function GetMyVar()
GetMyVar = "YourVariable"
End Function

Create a TextBox in your report and set its Control Source to =GetMyVar()
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.