Plugging todays today into Table Name

G

George

I use the following query to generate a list of addresses to mail to. I'd
like to be able to put the creation date into the name of the table (e.g.
INTO [20080815 FCP S1 Postcards to Send].) I realize I could do this
manually every time I run it, but I'd like to be able to do it
programatically. If this is possible, could someone give me a pointer as to
how to accomplish this? I want to be able to create the table name at run
time.

SELECT [GES].[ID], [GES].[CaseID], [GES].[Account], [GES].[OwnerName],
[GES].[PropAddr], [GES].[MailAddr1] AS Address1, [GES].[MailAddr2],
[GES].[MailCity], [GES].[MailState], [GES].[MailZIP], [GES].[DtUpdated],
[GES].[DtAdded], [GES].[DtLtrSent], [GES].[DocStatus], [GES].[EstSellDate]
INTO [FCP S1 Postcards to Send]
FROM GES
WHERE ((([GES].[DtLtrSent])=Date()) And (([GES].[DocStatus])="S2"))
ORDER BY [GES].[ID];
 
P

pietlinden

I use the following query to generate a list of addresses to mail to.  I'd
like to be able to put the creation date into the name of the table (e.g.
INTO [20080815 FCP S1 Postcards to Send].)   I realize I could do this
manually every time I run it, but I'd like to be able to do it
programatically.  If this is possible, could someone give me a pointer as to
how to accomplish this?  I want to be able to create the table name at run
time.

SELECT [GES].[ID], [GES].[CaseID], [GES].[Account], [GES].[OwnerName],
[GES].[PropAddr], [GES].[MailAddr1] AS Address1, [GES].[MailAddr2],
[GES].[MailCity], [GES].[MailState], [GES].[MailZIP], [GES].[DtUpdated],
[GES].[DtAdded], [GES].[DtLtrSent], [GES].[DocStatus], [GES].[EstSellDate]
INTO [FCP S1 Postcards to Send]
FROM GES
WHERE ((([GES].[DtLtrSent])=Date()) And (([GES].[DocStatus])="S2"))
ORDER BY [GES].[ID];

Why do you need a table? A table and a query both return the same
thing: a bunch of records. If all you wanted to do was log the fact
that you had sent something to a list of people in your address list,
you could just as easily create a cartesian product of people
(filtered)
mailings (filtered)
and then insert the (personID, MailingID, Date()) into the
SentMailings table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top