Re: FROM (tablename) question?
From: MaBell (MaBell_at_discussions.microsoft.com)
Date: 11/10/04
- Next message: Newly: "RE: I need to programmatically compare one record to a number of reco."
- Previous message: Ken Snell [MVP]: "Re: FROM (tablename) question?"
- In reply to: Ken Snell [MVP]: "Re: FROM (tablename) question?"
- Next in thread: Ken Snell [MVP]: "Re: FROM (tablename) question?"
- Reply: Ken Snell [MVP]: "Re: FROM (tablename) question?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 10 Nov 2004 07:44:09 -0800
Thanks. I got it to run using a string in VBA code but could you show me an
example of how to view the results or save it to use later?
Dim conDatabase As ADODB.Connection
Dim strSQL As String
Dim TableName1 As String
Set conDatabase = CurrentProject.Connection
'To be populated on the fly
TableName1 = "tblMFSFund"
strSQL = "SELECT * FROM " & TableName1
conDatabase.Execute strSQL
conDatabase.Close
Set conDatabase = Nothing
"Ken Snell [MVP]" wrote:
> You can do something like this using VBA code, where you build the SQL
> string into a variable, and then execute the query via VBA code.
>
> But if you want to have the query ask you for the tablename as a parameter
> when you run the query, as noted elsethread, the answer is no.
> --
>
> Ken Snell
> <MS ACCESS MVP>
>
>
> "MaBell" <MaBell@discussions.microsoft.com> wrote in message
> news:B7156F09-9816-4BB9-9580-A41BA06EE059@microsoft.com...
> > Can you setup a query to use a tablename passed as a parameterinstead of
> > hardcoded. I have multiple queries that are exactly the same except for
> table
> > name and I want just have one query and pass the table name depending on
> the
> > logic.
> >
> > Is that possible???
> > --
> >
> > Thanks in advance,
> > Matt
> > (access 2000)
>
>
>
- Next message: Newly: "RE: I need to programmatically compare one record to a number of reco."
- Previous message: Ken Snell [MVP]: "Re: FROM (tablename) question?"
- In reply to: Ken Snell [MVP]: "Re: FROM (tablename) question?"
- Next in thread: Ken Snell [MVP]: "Re: FROM (tablename) question?"
- Reply: Ken Snell [MVP]: "Re: FROM (tablename) question?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|