If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: SQL and parameters

Originally posted by andysiant
Are you saying that you've got a saved query with parameters and you want to call it using code? If so I think you'll need to use ADO to create a command and parameter object.

If you want to construct a query using vb code, you need to create a SQL string, eg:

Public Sub DoQuery(strTableName as string)

strSQL = "Select * from " & strTableName
docmd.runSQL strtSQL

End Sub

Hope this makes sense. If what you want to do is the first paragraph above, you need something like:

Dim cmd As New ADODB.Command

Thanks allot for your help,
My question is how I can send the Table Name for the DoQuery function
in the calling function (Public Sub DoQuery(strTableName as string))
I mean where can I get the all the tables names of my database to send
them as aparameter