Quantcast
Channel: anySiteSupport.com » SQL
Viewing all articles
Browse latest Browse all 4

Access VBA: How to copy a table

$
0
0

=========
QUESTION
———
How do I copy a table using VBA or SQL in Access?

 

=========
ANSWER
———
See EXAMPLES

NOTE: the use of of the square brackets (“[" and "]“) will save you a lot of grief! For instance in the example below, the date formatting having hyphens in it screws up the SQL  unless you surround the whole table name you are copying to in the square brackets.

 

=========
EXAMPLES
———
Me.CurrentStatus = “Backing Up   4010cT_WklyGoals table – Start Time: ” & Time() & vbCrLf & Me.CurrentStatus
Me.Repaint
strSQL = “SELECT [4010cT_WklyGoals].* INTO [4010cT_WklyGoals" & "_" & _
Format(Date, "YYYY-MM-DD") & "] FROM [4010cT_WklyGoals];”
‘Me.CurrentStatus = strSQL
DoCmd.RunSQL strSQL

 

=========
APPLIES TO / KEY WORDS
———
Microsoft Access
VBA
SQL
Copy Table

 

=========
REF
———

 


http://www.anysitesupport.com/access-vba-how-to-copy-a-table/
http://anySiteHosting.com


Viewing all articles
Browse latest Browse all 4

Trending Articles