PDA

View Full Version : How to pass variable to a textbox on access report



spatel911
09-15-2011, 08:42 AM
Hello,

In my click event button, Im declaring a "strIN" variable. I just want to call this variable on a text box which is on a report. I know i have to declare it globally in the module which I did. "Public strIN As String" but when I make my text box.value = strIN, it dosen't populate it.

tcoombes
09-22-2011, 10:01 PM
You need to create a function in a module somewhere (not form or report)
So of Your Variable was called VFred you add a function in a module


Function FFred()
FFred = VFred ' ie the function takes the value of your variable

End Function

Then go to your Report

Select the Field where it is to show

Select the properties of the field and put Control Source = FFred()

Note::- The control source can be a function not a variable.