farmerscott
Well-known Member
- Joined
- Jan 26, 2013
- Messages
- 824
- Office Version
- 365
- Platform
- Windows
Hi Everybody,
I have the following code and it works.
I would like to adjust it so that I don't have 2 invisible controls on my form.
Details-
1. I have a subform called "frmCashdissection" (many side) and a main form called "frmCashtransaction" (one side).
2. I have a table called "tblCashdissection" with two fields called "Credit" and "Debit"
3. When "income/expenses" is chosen from a combo box ("frmCashdissection") and an "Amount" is entered I would like the result to go direct to the table and not via the relevant control on the form.
So my question is- How to I refer to a table and field within VBA?
Further any general comments in taking this further, to mimic a bank statement with a running balance. I can get the debits and credits into their respective fields. But can I use an append query/DSum to get the running balance and put it into 'tblCashdissection".
thanks,
FarmerScott
I have the following code and it works.
VBA Code:
Private Sub Amount_AfterUpdate()
Me.Recalc
If Me.Controls![Income/Expense] = "Income" Then
Me.Controls![Credit] = Me.Controls![Amount]
Else
Me.Controls![Debit] = Me.Controls![Amount]
End If
End Sub
I would like to adjust it so that I don't have 2 invisible controls on my form.
Details-
1. I have a subform called "frmCashdissection" (many side) and a main form called "frmCashtransaction" (one side).
2. I have a table called "tblCashdissection" with two fields called "Credit" and "Debit"
3. When "income/expenses" is chosen from a combo box ("frmCashdissection") and an "Amount" is entered I would like the result to go direct to the table and not via the relevant control on the form.
So my question is- How to I refer to a table and field within VBA?
Further any general comments in taking this further, to mimic a bank statement with a running balance. I can get the debits and credits into their respective fields. But can I use an append query/DSum to get the running balance and put it into 'tblCashdissection".
thanks,
FarmerScott