hold a field for new record (1 Viewer)

Calvin Freeman

New member
Local time
Today, 05:07
Joined
May 26, 2020
Messages
3
I know that this is going to be simple for someone that knows the Syntax but here goes.

I have a table called "mortgagepayments". When I enter the Subform, called mortgagepayments3, I call up the last record and would like to hold the value of a field called mort_currentbal.
Then call up a new record. In the new record I would like to input the value that I am holding into a field called mort_previousbal. I've tried the code several different ways but it always errors.
My latest code is

Private Sub mortgage_payments_part3_Enter()
Dim balance As Currency

RunCommand acCmdRecordsGoToLast
SELECT [mortgagepayments.mort_currentbal] as balance From CurrentRecord
RunCommand acCmdRecordsGoToNew
INPUT [mort.previousbal] = balance

End Sub
 

June7

AWF VIP
Local time
Today, 04:07
Joined
Mar 9, 2014
Messages
5,423
Ideally, aggregate data is not saved to table, balance should be calculated when needed.

Set a variable that can be referenced later - options: textbox on form, global variable, TempVars.

This will not involve a SELECT statement, which can't be used as you show anyway.

Simple examples:

Me.tbxBal = Me.Balance

gblBal = Me.Balance

I have never used TempVars so will let you do research.

Real trick is figuring out what event to put code into.
 

Calvin Freeman

New member
Local time
Today, 05:07
Joined
May 26, 2020
Messages
3
The event that I am putting the code into is the enter the form event. I'll take a look at you suggestions
Thanks
 

Users who are viewing this thread

Top Bottom