Solved

transfer table programmatically

Posted on 2012-03-28
2
389 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

628 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