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 or Sub with parms (reusable)

Status
Not open for further replies.

tzamora

Programmer
Apr 15, 2002
27
0
0
US
I am trying to write a function or sub that I can call with parms.

function f_LookUp(ps_sql As String) As String
.................
.... more code...
.................
LookUp_rst.Open ps_sql, LookUp_cxn, adOpenStatic, adLockReadOnly, adCmdText
.................

.... more code...
.................
f_LookUp = LookUp_rst!first_name
.....................!any_column
*** Here is the problem I am not always pulling the first_name (how can I make this part dynamic?)
 
What if you tried this

function f_LookUp(ps_sql As String, OPtional ByVal LookupField as String="") As String


.. Build or Append the string here

.. Execute the SQl Command
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top