A
Amateur
Dear Sirs,
I have a command button which transfers data from a table to a table in
another database.
This is the code:
*************************************************
Private Sub cmdTransfer_Click()
On Error GoTo Err_Handler
Dim strTargetDB As String
Dim strTargetTable As String
Dim strSQL As String
strTargetDB = " C:\Documents and Settings\Klaus
Müller\Desktop\cps207\transferdb.mdb "
strTargetTable = " webtotalbalancebie30p "
strSQL = _
"INSERT INTO [" & strTargetTable & _
"] (accountnumber, initialinvestment, guaranteedequity) IN '" & _
strTargetDB & _
"' SELECT webtotalbalancebie30p.accountnumber,
webtotalbalancebie30p.initialinvestment,
webtotalbalancebie30p.guaranteedequity " & _
"FROM webtotalbalancebie30p;"
CurrentDb.Execute strSQL, dbFailOnError
Exit_Point:
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error " & Err.Number
Resume Exit_Point
End Sub
******************************************************
I would like to transfer as well data to another table in the same taget
database.
which should look more or less like this:
strSQL = _
"INSERT INTO [" & strTargetTable & _
"] (tradeid, clearingnumber, date, bought, sold, commodity,
month, year, price, contractvalue) IN '" & _
strTargetDB & _
"' SELECT weboffsetordersbie30p.tradeid,
weboffsetordersbie30p.clearingnumber, weboffsetordersbie30p.date,
weboffsetordersbie30p.bought, weboffsetordersbie30p.sold,
weboffsetordersbie30p.commodity, weboffsetordersbie30p.month,
weboffsetordersbie30p.year, weboffsetordersbie30p.price,
weboffsetordersbie30p.contractvalue " & _
"FROM weboffsetordersbie30p;"
How can I combine both button commands so that the transactions are done
with one button click?
Thanks for your help
I have a command button which transfers data from a table to a table in
another database.
This is the code:
*************************************************
Private Sub cmdTransfer_Click()
On Error GoTo Err_Handler
Dim strTargetDB As String
Dim strTargetTable As String
Dim strSQL As String
strTargetDB = " C:\Documents and Settings\Klaus
Müller\Desktop\cps207\transferdb.mdb "
strTargetTable = " webtotalbalancebie30p "
strSQL = _
"INSERT INTO [" & strTargetTable & _
"] (accountnumber, initialinvestment, guaranteedequity) IN '" & _
strTargetDB & _
"' SELECT webtotalbalancebie30p.accountnumber,
webtotalbalancebie30p.initialinvestment,
webtotalbalancebie30p.guaranteedequity " & _
"FROM webtotalbalancebie30p;"
CurrentDb.Execute strSQL, dbFailOnError
Exit_Point:
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error " & Err.Number
Resume Exit_Point
End Sub
******************************************************
I would like to transfer as well data to another table in the same taget
database.
which should look more or less like this:
strSQL = _
"INSERT INTO [" & strTargetTable & _
"] (tradeid, clearingnumber, date, bought, sold, commodity,
month, year, price, contractvalue) IN '" & _
strTargetDB & _
"' SELECT weboffsetordersbie30p.tradeid,
weboffsetordersbie30p.clearingnumber, weboffsetordersbie30p.date,
weboffsetordersbie30p.bought, weboffsetordersbie30p.sold,
weboffsetordersbie30p.commodity, weboffsetordersbie30p.month,
weboffsetordersbie30p.year, weboffsetordersbie30p.price,
weboffsetordersbie30p.contractvalue " & _
"FROM weboffsetordersbie30p;"
How can I combine both button commands so that the transactions are done
with one button click?
Thanks for your help