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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function Help

Status
Not open for further replies.

locke

Instructor
Apr 12, 2001
1
0
0
CA
I have a form that contains 2 other subforms.&nbsp;&nbsp;The main form's fields list doesn't contain the field that i need to do the calculation.&nbsp;&nbsp;The field i need is in a query..so when i try to put this on the main form, inside a txtbox's control source =avg([QueryTable]![QueryField]), it just gives me #name. <br>Anyway around this?<br>thanks,
 
You could create a function in the Modules TAB<br><br>How well do you speak VBA?<br><br>Public Function FunctionName(Value1,Value2)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Do your calculations here<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'or Look up data in any table(s)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FunctionName = Some value ' &lt; This is a must. The function name has to be passed the final answer<br><br>End Function<br><br>Call your function from an unbound textbox on your form like so: <br>Textbox to have calculation. =FunctionName(Me!Text,Me!Text2) <br>Make sure your Textboxes name that recieves the calculation is different than any other textbox on any form.<br><br>If you are more specific about your formula I can write you a complete function.&nbsp;&nbsp;<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top