I'm not quite sure what you're asking.
Are you saying that have a text box on your form, and you want to be able to
put the name of the table there?
If the text box is named, say, txtTableName, you'd use:
strSQL = "Select * from [" & Me.txtTableName & "]"
(The reason for leaving the square brackets there is just in case any of
your table names include blanks, which I wouldn't recommend by the way).
In fact, you could use a combo box that returned the names of the tables,
and save your users having to type. The following query will return all your
table names, so could be used as a Row Source for the combo box:
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Tybor" <(E-Mail Removed)> wrote in message
news:2A5B1994-BD86-429D-963E-(E-Mail Removed)...
>I would like to set up a utility that I could run the same code on
>different
> tables by changing the value of an unbound text from a form to the code.
> In
> the following code what could I put in for [any table] that would allow
> this?
> Or is there another way?
>
> Sub any_Table()
> Dim db As Database
> Dim rsProvider As DAO.Recordset
>
> Dim strSQL As String
> Dim iPos, iLen As Integer
>
> Set db = CurrentDb
>
> strSQL = "Select * from [Any table]"
> Set rsProvider = db.OpenRecordset(strSQL, dbOpenDynaset)
>
> blah blah
> end sub
>
> Thanks
> --
> XTybor