473,668 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Function to Append DATE to output tablename for Make Table Query

Hi all,

Is there a function (or other method) to automatically append the system
date to the output tablename of a make table query such that the new one
does not overwrite an older table?.

I need these for stats but want to keep all previous tables created by
the same query and I do not want the user to have to enter the date the
table was created.

Output table name BASETABLENAME_[mmddyy]

Thanks in advance.

Maur
Nov 12 '05 #1
4 8676
Pat
This will give you a table named "MyTableCreated OnMMDDYY" I choked on
getting Access to take an underscore or bracket in the name table SQL. If
there's a simple way to do this, I'd be happy to read about it.

Sub NameTable()

Dim strTableName As String
Dim strSql As String
Dim dbs As DAO.Database
Dim rs As DAO.Recordset

strTableName = "MyTableCreated On" & Format(Now(), "mmddyy")
Set dbs = CurrentDb
strSlq = "CREATE TABLE " & Trim(strTableNa me) & " (FirstField TEXT,
SecondField TEXT)"
dbs.Execute (strSlq)
Set dbs = Nothing

End Sub
"Mo Ka" <m-********@earthl ink.net> wrote in message
news:HA******** *********@newsr ead3.news.atl.e arthlink.net...
Hi all,

Is there a function (or other method) to automatically append the system
date to the output tablename of a make table query such that the new one
does not overwrite an older table?.

I need these for stats but want to keep all previous tables created by
the same query and I do not want the user to have to enter the date the
table was created.

Output table name BASETABLENAME_[mmddyy]

Thanks in advance.

Maur

Nov 12 '05 #2
Mo Ka <m-********@earthl ink.net> wrote in message news:<HA******* **********@news read3.news.atl. earthlink.net>. ..
Hi all,

Is there a function (or other method) to automatically append the system
date to the output tablename of a make table query such that the new one
does not overwrite an older table?.

I need these for stats but want to keep all previous tables created by
the same query and I do not want the user to have to enter the date the
table was created.

Output table name BASETABLENAME_[mmddyy]

Thanks in advance.

Maur


Public Sub BackupTable(ByV al strTableToBacku p As String)
Dim strNewName As String
strNewName = strTableToBacku p & "_" & Format(Date, "mmddyyyy")
DoCmd.CopyObjec t "", strNewName, acTable, strTableToBacku p

End Sub
Nov 12 '05 #3
Thank you Pat and Pieter!

Mo

Mo Ka wrote:

Hi all,

Is there a function (or other method) to automatically append the system
date to the output tablename of a make table query such that the new one
does not overwrite an older table?.

I need these for stats but want to keep all previous tables created by
the same query and I do not want the user to have to enter the date the
table was created.

Output table name BASETABLENAME_[mmddyy]

Thanks in advance.

Maur

Nov 12 '05 #4
"Pat" <no*****@ihates pam.bum> wrote in
news:%b******** ***********@fe2 .texas.rr.com:
This will give you a table named "MyTableCreated OnMMDDYY" I
choked on getting Access to take an underscore or bracket in
the name table SQL. If there's a simple way to do this, I'd
be happy to read about it.

The square brackes are your friends. :)
examples
strTableName = _
"[MyTableCreatedO n_" & Format(Now(), "mmddyy") & "]"
or
strTableName = _
"[My Table Created On " & Format(Now(), "medium date" ) & "]"
even
strTableName = _
"[My Table, (" & Format(Now(), "mmddyy" & ")]"

I haven't succeeded with embedded [], however.

Bob Quintal


Sub NameTable()

Dim strTableName As String
Dim strSql As String
Dim dbs As DAO.Database
Dim rs As DAO.Recordset

strTableName = "MyTableCreated On" & Format(Now(), "mmddyy")
Set dbs = CurrentDb
strSlq = "CREATE TABLE " & Trim(strTableNa me) & " (FirstField
TEXT, SecondField TEXT)"
dbs.Execute (strSlq)
Set dbs = Nothing

End Sub
"Mo Ka" <m-********@earthl ink.net> wrote in message
news:HA******** *********@newsr ead3.news.atl.e arthlink.net...
Hi all,

Is there a function (or other method) to automatically append
the system date to the output tablename of a make table query
such that the new one does not overwrite an older table?.

I need these for stats but want to keep all previous tables
created by the same query and I do not want the user to have
to enter the date the table was created.

Output table name BASETABLENAME_[mmddyy]

Thanks in advance.

Maur



Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
13485
by: Bob | last post by:
Everybody, I've been doing a lot of on-line research and cannot find any reference to the exact problem I'm having. Let me preface this question with the fact that I'm coming from an Oracle background so my approach may not be the best way to tackle this. However, from the research I have done this approach seems reasonable. Also, I know about the undocumented procedure sp_MSforeachtable. That can give me a
2
5241
by: John | last post by:
Hi - I am trying to perform a simple append query, with no luck. I have a table (MktPrices) that has the following fields: BondID, PriceDate, Price. The objective is to allow the user to input a date and have the append query create a new record for each BondID, using the input date and the most recent price - which the user can then update on a tabular form. I have created a totals query (qryMostRecentPrice) which selects the most...
6
1753
by: Mark | last post by:
I'm looking for how to set up a query to return the record with the previous date to the most recent date. Example: ReturnDate: 11/15/03 12/12/03 2/4/04 4/5/04 The most recent date is 4/5/04. I need to return the record with 2/4/04.
2
397
by: Mo Ka | last post by:
Hi all, Is there a function (or other method) to automatically append the system date to the output tablename of a make table query such that the new one does not overwrite an older table?. I need these for stats but want to keep all previous tables created by the same query and I do not want the user to have to enter the date the table was created.
1
2477
by: David Barger | last post by:
Greetings, It appears that an Append Query I run in Access XP is randomly failing to append a field. I have payroll data being entered into a payroll database. This data is exported daily to two csv files. (One for updated data, and the other for unupdated data.) The CSV files are attached to my Jobcosting database. After the CSV
11
3785
by: kennthompson | last post by:
Trouble passing mysql table name in php. If I use an existing table name already defined everything works fine as the following script illustrates. <?php function fms_get_info() { $result = mysql_query("select * from $tableInfo") ; for ($i = 0; $i < mysql_num_rows($result); $i++) {
4
2402
by: dougmeece | last post by:
Morning Everyone... I have a table that needs to be append to and also updated. All the fields in the table are populated with data from the text boxes and combo boxes on a form. The Date Submitted defaults to 1/1/00 if the cboSubmittedBox field is "No". Otherwise it is selected from a calendar. The Date Entered field defaults to the current date. There are 3 sets of criteria that need to be checked for the update or append to take place. ...
8
2776
by: Dr Al | last post by:
I have a table with four date fields, some of which may not be filled in based on our data entry needs. I have a criteria set as <date()-180 which is supposed to pull dates older than 180 days ago. The problem is that when I use that criteria for all four fields I am not getting the expected results. I am trying to find out from this query is the date in date field one is older than 180, same thing for the other three date fields. For...
1
6463
by: Beamor | last post by:
function art_menu_xml_parcer($content, $showSubMenus) { $doc = new DOMDocument(); $doc->loadXML($content);//this is the line in question $parent = $doc->documentElement; $elements = $parent->childNodes; need help. my site worked fine on my localhost but when i uploaded it to my live server i keep getting this error need help to recode line to match my hosting server. im using php 5 i have attached the common_method file
0
8462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8381
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8799
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7401
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5681
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4205
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2026
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.