TransferDatabase

Dina01

Registered User.
Local time
Today, 02:04
Joined
Apr 24, 2002
Messages
87
Hello,

I was wondering if it's possible to create tables with different names everytime I click on the transfer button...Because I don't want my tables to overwrite the data that is already there...

Therefore would it be possible, if everytime I click on the CmdTransfer button, and my two tables save in the other db, well they get diffrent names, for example if I have already a table named AgentTrackingModification_tb and DataTracking_tb, the the other will be AgentTrackingModification1_tb and DataTracking1_tb and so on therefre they don't overwrite themselves...


Private Sub CmdTransfer_Click()

DoCmd.TransferDatabase acExport, "Microsoft Access", _
"L:\HoraSec\Data\DispatchBackUp.mdb", acTable, "AgentTrackingModification_tb", _
"AgentTrackingModification_tb"

DoCmd.TransferDatabase acExport, "Microsoft Access", _
"L:\HoraSec\Data\DispatchBackUp.mdb", acTable, "DataTracking_tb", _
"DataTracking_tb"

End Sub
 
Can anyone please help me with this issue
 
The syntax is simple enough:

DoCmd.TransferDatabase acExport, "Microsoft Access",
"L:\HoraSec\Data\DispatchBackUp.mdb", acTable, "DataTracking_tb",
SomeVariableName

The bigger problem is figuring out what you want the name to be.

I don't understand why you want to create a new table each time. That will be really annoying to work with in the other db. Why don't you want to append the new records to an existing table?
 
transferdatabase

hello Dinah

I would like perheaps to answer to your question. I read carefuly
your message and the other answers.
My knowledge in ACCESS are not enough to give you a "click magical solution" for your transferdatabase.

What i propose to you, if it suits you, is to create a form.
place upon it a dropdownlistbox and a click button.

Name the dropdownlistbox "tag1". populate it with different name of table (for instance table1; table2; table3 etc.....)

paste in the clik button this code


Private Sub Commande0_Click()


' focus on the dropdownlistbox and take it's value

Dim var1 As String
Me.Tag.SetFocus
var1 = Tag.Text


' apply this value to the new table name.

DoCmd.TransferDatabase acExport, "Microsoft Access", _
"C:\test\mybase.mdb", acTable, "masters", var1

MsgBox "success"

End Sub


This code enable you to transfer (in this exemple) the table "masters" to the database "mybase", but with the name you will have chosen in the dropdownlistbox. Thus, in the dropdownlistbox, it is possible to popuilate it with names like
AgentTrackingModification_tb1, AgentTrackingModification_tb2
AgentTrackingModification_tb3 etc......

The same things go for your second table.

Perheaps, are there more automated solutions..............


Hope it will help you and that my english and explanation are clear enough

Pitou
 
transferdatabase

Excuse me Dinah

name the dropdownlistbox "tag" and not "tag1"
it should not be in accordance with the code i gave you
 

Users who are viewing this thread

Back
Top Bottom