Solved

transfer table programmatically

Posted on 2012-03-28
2
329 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 119

Accepted Solution

by:
Rey Obrero 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now