Connecting Tech Pros Worldwide Forums | Help | Site Map

Make Table Query Question

JJ
Guest
 
Posts: n/a
#1: Nov 12 '05
I have a Make Table query which uses a date parameter. Each time the
user runs the query they will be prompted for a date. The table which
is created should be named based on the date which they entered. For
example: The query will retieve all invoices dated xxxxx, the user
will may supply the date of Jan 1 2004. It should create a table
called "Jan 1 2004 Invoices" (or something like that). Each table
created needs to be saved in the database with an appropriate name.
How can I have the query create a table with a name based on the date
input?

Squirrel
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Make Table Query Question


I'd try it this way.
Offer the user a form with a textbox in which to enter the date.
The user enters e.g. 4/15/2003 and you could put an input mask on the
control to ensure
a valid date is entered.
Then he hits a command button and you could run code like this:

docmd.runsql "SELECT InvoiceTable.* INTO " & getTableName(me!txtDate) & _
" FROM InvoiceTable where InvoiceDate = #" & me!txtDate & "#;"

Function getTableName(myDate As Date) As String
getTableName = "Invoices" & Format(myDate, "mdyyyy")
End Function


"JJ" <jjrao@optonline.net> wrote in message
news:86a49515.0402031812.4ef3f62a@posting.google.c om...[color=blue]
> I have a Make Table query which uses a date parameter. Each time the
> user runs the query they will be prompted for a date. The table which
> is created should be named based on the date which they entered. For
> example: The query will retieve all invoices dated xxxxx, the user
> will may supply the date of Jan 1 2004. It should create a table
> called "Jan 1 2004 Invoices" (or something like that). Each table
> created needs to be saved in the database with an appropriate name.
> How can I have the query create a table with a name based on the date
> input?[/color]


Closed Thread