Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In a VBA module(function) how do I get the value from a combobox?

Status
Not open for further replies.

hcsd

Programmer
May 17, 2000
22
US
I am working in Access and have created a <font color=red>function</font>. I now need to set a <font color=red>variable</font> in the <font color=red>function</font> to the value of the combobox from an Access form.<br>
 
Just pass the value.<br>For Example:<br><br>Public Function GetValue(intValue as Integer) as Integer<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GetValue = intValue + 100<br>End Function<br><br>On the After Update event of the combo box put the following:<br><b>If Not Isnull(Me.ComboBox) Then x = GetValue(Me.ComboBox)</b><br><br><br>So if the value in the combo box was 25, then you would pass <b>25</b> to the GetValue Function.<br><br>In the Function, the intValue parameter now becomes <b>25</b><br>The function would then return <b>125</b>, so now <b>x = 125</b><br> <p>Jim Lunde<br><a href=mailto:compugeeks@hotmail.com>compugeeks@hotmail.com</a><br><a href= Application Development
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top