PC Review


Reply
Thread Tools Rate Thread

Create Table with Date Appended

 
 
Cathy
Guest
Posts: n/a
 
      3rd Jun 2010
How would I create a new table (tblNew), based on information in an existing
table (tblCurrentData), with today's date appended to the end of the tblNew
name? ( ie: tblNew06032010)

What I am trying to do is, I need a mechanism to store the last four days
worth of data so that comparisons can be made. I can then delete the tables
that are at least 5 days old.
 
Reply With Quote
 
 
 
 
Daniel Pineault
Guest
Posts: n/a
 
      3rd Jun 2010
To directly answer your question, you can do it using the CopyObject Method

DoCmd.CopyObject(DestinationDatabase, NewName, SourceObjectType,
SourceObjectName)

However, the fact that you are doing this make me question your data
normalization. You should keep all your data, and the filter... as you need.
You shouldn't need to create copies of tables based on dates. This is bad!

I would reevaluate your table structure a little before continuing any
further. If you need help, post your current setup and I'm sure we can help
you find the proper setup to suit your needs.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"Cathy" wrote:

> How would I create a new table (tblNew), based on information in an existing
> table (tblCurrentData), with today's date appended to the end of the tblNew
> name? ( ie: tblNew06032010)
>
> What I am trying to do is, I need a mechanism to store the last four days
> worth of data so that comparisons can be made. I can then delete the tables
> that are at least 5 days old.

 
Reply With Quote
 
Cathy
Guest
Posts: n/a
 
      3rd Jun 2010
Daniel,

The table is for accounting forecasting data. The users have a habit of
updating it several times, then change their mind and want to compare back to
something they had a couple of days ago.

I need to create versions so that they can do their job. How else would you
suggest accomplishing this?

I've tried your suggestion, and I can't seem to make " & Now()" work at the
end of the table name. How would you automate adding the date to the table
name using CopyObject?

Thank you so much for your help.

Cathy

"Daniel Pineault" wrote:

> To directly answer your question, you can do it using the CopyObject Method
>
> DoCmd.CopyObject(DestinationDatabase, NewName, SourceObjectType,
> SourceObjectName)
>
> However, the fact that you are doing this make me question your data
> normalization. You should keep all your data, and the filter... as you need.
> You shouldn't need to create copies of tables based on dates. This is bad!
>
> I would reevaluate your table structure a little before continuing any
> further. If you need help, post your current setup and I'm sure we can help
> you find the proper setup to suit your needs.
> --
> Hope this helps,
>
> Daniel Pineault
> http://www.cardaconsultants.com/
> For Access Tips and Examples: http://www.devhut.net
> Please rate this post using the vote buttons if it was helpful.
>
>
>
> "Cathy" wrote:
>
> > How would I create a new table (tblNew), based on information in an existing
> > table (tblCurrentData), with today's date appended to the end of the tblNew
> > name? ( ie: tblNew06032010)
> >
> > What I am trying to do is, I need a mechanism to store the last four days
> > worth of data so that comparisons can be made. I can then delete the tables
> > that are at least 5 days old.

 
Reply With Quote
 
Daniel Pineault
Guest
Posts: n/a
 
      3rd Jun 2010
Your code would need to be something like something like

DoCmd.CopyObject , "tblNew" & Format(Date,"mmddyyyy"), acTable,
"tblCurrentData"
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"Cathy" wrote:

> Daniel,
>
> The table is for accounting forecasting data. The users have a habit of
> updating it several times, then change their mind and want to compare back to
> something they had a couple of days ago.
>
> I need to create versions so that they can do their job. How else would you
> suggest accomplishing this?
>
> I've tried your suggestion, and I can't seem to make " & Now()" work at the
> end of the table name. How would you automate adding the date to the table
> name using CopyObject?
>
> Thank you so much for your help.
>
> Cathy
>
> "Daniel Pineault" wrote:
>
> > To directly answer your question, you can do it using the CopyObject Method
> >
> > DoCmd.CopyObject(DestinationDatabase, NewName, SourceObjectType,
> > SourceObjectName)
> >
> > However, the fact that you are doing this make me question your data
> > normalization. You should keep all your data, and the filter... as you need.
> > You shouldn't need to create copies of tables based on dates. This is bad!
> >
> > I would reevaluate your table structure a little before continuing any
> > further. If you need help, post your current setup and I'm sure we can help
> > you find the proper setup to suit your needs.
> > --
> > Hope this helps,
> >
> > Daniel Pineault
> > http://www.cardaconsultants.com/
> > For Access Tips and Examples: http://www.devhut.net
> > Please rate this post using the vote buttons if it was helpful.
> >
> >
> >
> > "Cathy" wrote:
> >
> > > How would I create a new table (tblNew), based on information in an existing
> > > table (tblCurrentData), with today's date appended to the end of the tblNew
> > > name? ( ie: tblNew06032010)
> > >
> > > What I am trying to do is, I need a mechanism to store the last four days
> > > worth of data so that comparisons can be made. I can then delete the tables
> > > that are at least 5 days old.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get record I just appended to a table? Tim Microsoft Access Queries 3 7th Feb 2008 08:00 PM
Pivot Table DataFields are appended with a '2', why? =?Utf-8?B?U3Vuc2hpbmVY?= Microsoft Excel Misc 1 12th Jul 2005 06:15 PM
Dynamically create a table with a text box appended =?Utf-8?B?Z29pdHo=?= Microsoft C# .NET 0 9th Jun 2004 09:06 PM
Value from form to be appended to table Vikesh Singh Microsoft Access Forms 3 3rd Feb 2004 06:41 PM
Decimal precision in appended table JL Microsoft Access Queries 1 24th Jul 2003 10:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:30 PM.