Thanks Arnie, that is the advice of Aaron as well.
I'm not really too sure now that I want to go the dynamic SQL route. I will
"Arnie Rowland" <arnie@1568.com> wrote in message
news:OkBHqdj8GHA.1496@TK2MSFTNGP05.phx.gbl...
> You will have to build a dynamic sql string and then execute it using
> sp_executesql.
>
> I recommend reading this article:
>
> Dynamic SQL - The Curse and Blessings of Dynamic SQL
>
http://www.sommarskog.se/dynamic_sql.html >
>
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
>
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
>
>
> "David" <myself@someISP.Com> wrote in message
> news:%23dcrrVj8GHA.4964@TK2MSFTNGP02.phx.gbl...
> > Hello all
> >
> > In my VB6 programme, I have numerous functions that retrieve data from a
> > Jet
> > 4.0 database.
> > As a some of the data retrieval is pretty much the same except for the
> > table
> > and the fields that I require, I have written several generic functions
to
> > get my data, similar to this:
> >
> >
> > Public Function Get_Data_From_A_Table(strTable as String, strField As
> > String, strAnotherField As String) As ADODB.Recordset
> > Dim strSQL as String
> >
> > Open the connection etc
> > .......................
> > ......................
> > ...........
> >
> > strSQL = "Select " & strTable & "." & strField &" , " & strTable &
"."
> > &
> > strAnotherField &" _
> > & "FROM " & strTable &"
> > &" WHERE " & strTable & "." & strField &" >1"
> >
> > Get the recordset etc
> >
> >
> > My question is, can I pass strTable, strField, strAnotherField into a
> > stored
> > procedure in a similar fashion? How would I write it in terms of
> >
> > Create Procedure Get_Data_From_A_Table (@Table_T varChar(30), @Field_F
> > varChar(30), AnotherField_F varChar(30))
> >
> > SELECT ?? ??
> >
> > Thanks for any advice
> >
> > Regards
> >
> > David
> >
> >
>
>