Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Dateserial expression to Make Table SQL 1

Status
Not open for further replies.

Binnit

Technical User
Apr 28, 2004
627
US
I have the following strSQL in a module and would like to add the date of the last day of previous month to it so that it creates a unique table each month:-

Code:
strSQL = "SELECT * INTO [tblQPDItems]FROM qryQPDDeclaration;"

For example, for October it should create a table called tblQPDItems 30/09/2006 but am not sure how to concatenate the dateserial function within the SQL string.

Thanks in anticipation











If IT ain’t working Binnit and Reboot
 
Have resolved this by using Copy Object method
DoCmd.CopyObject , "QPDItems as at " & DateSerial(Year(Date), Month(Date), 1 - 1), acTable, "qryQPDDeclaration"

I would still like to know if the original method is possible.



If IT ain’t working Binnit and Reboot
 
strSQL = "SELECT * INTO [QPDItems as at " & DateSerial(Year(Date), Month(Date), 0) & "] FROM qryQPDDeclaration;"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV
Thanks, although having changed my method, your assistance will provide an alternative method for future use.

As always - great stuff



If IT ain’t working Binnit and Reboot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top