Hi All,
I have recorded an SQL Query which I would like to amend to include a calculation where two columns in the table are multiplied.
The query:
I would like to multiply
by
with the result of the multiplication being returned as a series of positive and negatives values instead of both columns
Is anyone familiar with how this could be accomplished?
Cheers
Shaun
I have recorded an SQL Query which I would like to amend to include a calculation where two columns in the table are multiplied.
The query:
Code:
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array(Array( _
"ODBC;DSN=MS Access Database;DBQ=" & fpth & ";DefaultDir=" & fdir & ";DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;" _
)), Destination:=Range("$A$5")).QueryTable
.CommandText = Array( _
"SELECT MYOX_JournalTransactionLines.AccountUID, MYOX_JournalTransactionLines.AccountNumber, MYOX_Accounts.Type, MYOX_JournalTransactionLines.AccountName, MYOX_JournalTransactions.DateOccurred, MYOX_Jo" _
, _
"urnalTransactionLines.Amount, MYOX_JournalTransactionLines.IsCredit, MYOX_JournalTransactionLines.JobNumber" & Chr(13) & "" & Chr(10) & "FROM MYOX_Accounts MYOX_Accounts, MYOX_JournalTransactionLines MYOX_JournalTransactionLines" _
, _
", MYOX_JournalTransactions MYOX_JournalTransactions" & Chr(13) & "" & Chr(10) & "WHERE MYOX_Accounts.AccountUID = MYOX_JournalTransactionLines.AccountUID AND MYOX_JournalTransactions.JournalTransactionUID = MYOX_JournalTransacti" _
, "onLines.JournalTransactionUID")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Data"
.Refresh BackgroundQuery:=False
End With
I would like to multiply
Code:
MYOX_JournalTransactionLines.Amount
Code:
MYOX_JournalTransactionLines.IsCredit
Is anyone familiar with how this could be accomplished?
Cheers
Shaun