|
-
Jan 12th, 2013, 06:49 PM
#5
Thread Starter
PowerPoster
Re: How Does VB I Want to Use MSAccess
DataMiser
Not trying to be argumentative, and I understand your point, but so is VB Classic, VB ADO, as well as a lot of other languages (ALGOL, PL1, etc. to name a couple).
If you have a large DB to maintain you can't be jumping languages everytime M$ or any other business that has a foothold wants to change for the purpose of making $$$$$$$.
I for one am OLD enough to have gone through a number of languages and am just plain tired of the wheel being reinvented since the ONLY objective
is to get something into memory, manipulate it, and get it out again.
Per Wiki DAO is an integral part of Windows (like IE) and is supported through Window 7 (not sure about Win 8 and date of Wiki article).
Will keep hoping someone has the answer.
Using an MSDN example for VBA still errors.
Code:
Public Sub TransferFunds()
'FOR TEST
Dim wrk As DAO.Workspace
Dim dbC As DAO.Database
Dim dbX As DAO.Database
Set wrk = DBEngine(0)
Set dbC = DaoDb 'CurrentDb
Set dbX = wrk.OpenDatabase(GetPath(PATH_DBBackUp))
Dim strSQL As String
On Error GoTo trans_Err
'Begin the transaction
wrk.BeginTrans
'Withdraw funds from one account table
' dbC.Execute "INSERT INTO tblAccounts ( Amount, Txn, TxnDate ) SELECT -20, 'DEBIT', Date()", dbFailOnError
strSQL = "INSERT INTO Restore2348_0 SELECT * "
Debug.Print strSQL
dbX.Execute strSQL, dbFailOnError
'Deposit funds into another account table
' dbX.Execute "INSERT INTO tblAccounts ( Amount, Txn, TxnDate ) SELECT 20, 'CREDIT', Date()", dbFailOnError
' dbC.Execute "INSERT INTO Restore2348_0_H SELECT * ", dbFailOnError
strSQL = "INSERT INTO Restore2348_0_H SELECT * "
Debug.Print strSQL
dbC.Execute strSQL, dbFailOnError
'Commit the transaction
wrk.CommitTrans dbForceOSFlush
trans_Exit:
'Clean up
wrk.Close
Set dbC = Nothing
Set dbX = Nothing
Set wrk = Nothing
Exit Sub
trans_Err:
'Roll back the transaction
wrk.Rollback
Resume trans_Exit
End Sub
Last edited by dw85745; Jan 12th, 2013 at 07:09 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|