Solved

transfer table programmatically

Posted on 2012-03-28
2
372 Views
Last Modified: 2012-03-28
I need to send a table that is sent to us daily to an archive when we are through with it.
The name of the table is something like PRWBBEPI_****. The last 4 digits will be different. Can i use a wild card in the function and if so, how? Thanks for any help



Public Function Send2Archive()

 DoCmd.TransferDatabase transfertype:=acExport, _
  databasetype:="Microsoft Access", _
  databasename:="C:\Documents and Settings\Leidago\My Documents\destination.mdb", _
  ObjectType:=acTable, Source:="users", _
  Destination:="userstbl", structureonly:=False
 
 
End Function
0
Comment
Question by:Serena2345
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 37778035
do you have more than one table that starts with "PRWBBEPI_" ?

dim td as dao.tabledef, db as dao.database, sTable as string
set db=currentdb

for each td in db.tabledefs
        if left(td.name,9)="PRWBBEPI_" then
            sTable=td.name

            msgbox sTable

           
            Send2Archive stable
next


you can change your function to accept variable names

Public Function Send2Archive(strTable as string)

 DoCmd.TransferDatabase transfertype:=acExport, _
  databasetype:="Microsoft Access", _
  databasename:="C:\Documents and Settings\Leidago\My Documents\destination.mdb", _
  ObjectType:=acTable, Source:=strTable, _
  Destination:=strTable, structureonly:=False
 
 
End Function
0
 

Author Comment

by:Serena2345
ID: 37778183
There is a table called PRWBBEPI" but no "_" so your suggestion should work. As always Cappie Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question