Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Account Balances 7 > < Filter Combo | Account Balances 8 >
Account Balances 7
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   3 years ago

Track Account Balances & Transactions, Part 7


 S  M  L  XL  FS  |  Slo  Reg  Fast  2x  |  Bookmark Join Now

This is part 7 of my Microsoft Access Account Balances tutorial series. In this series we will build a database to track your account balances and daily transactions.

Today, we're going to fix a bug discovered by a student. Then we're going to change the background color of some of the fields if they have focus, and always change the background color of the SortOrder field if the focus is in that row. We're going to add an "are you sure" to the Cancel button on the account detail form in case someone hits ESC by accident. We're going to add the capability to put equations in the Pending field. We'll need to make some adjustments to the Conditional Formatting.

Members

Members will learn how to optimize the account list sorting with a recordset. This will make it run much faster and more efficiently.

Silver Members and up get access to view Extended Cut videos, when available. Gold Members can download the files from class plus get access to the Code Vault. If you're not a member, Join Today!

Prerequisites

Suggested Template

Links

Member Links

Recommended Courses

Next Video

Learn More

FREE Access Beginner Level 1
FREE Access Quick Start in 30 Minutes
Access Level 2 for just $1

Free Templates

TechHelp Free Templates
Blank Template
Contact Management
Order Entry & Invoicing
More Access Templates

Resources

Diamond Sponsors - Information on our Sponsors
Mailing List - Get emails when new videos released
Consulting - Need help with your database
Tip Jar - Your tips are graciously accepted
Merch Store - Get your swag here!

Questions?

Please feel free to post your questions or comments below or post them in the Forums.

KeywordsAccount Balances in Microsoft Access, Part 7

access 2016, access 2019, access 2021, access 365, microsoft access, ms access, ms access tutorial, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #learn, #lesson, #training, #database, On Dirty Event, Dirty Property, change background color of field on focus, change background color of another field on focus, are you sure cancel button, equations in fields in continuous forms, optimize sort with recordset

 

 

Comments for Account Balances 7
 
Age Subject From
2 yearsBalance no longer updatesTannim Hallman
3 yearsMath CalculationsSandra Truax

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to Account Balances 7
Get notifications when this page is updated
 
Intro In this video, we continue building our Microsoft Access account balances database by fixing a VBA bug reported by a student, improving field focus visuals with conditional formatting, and updating the sort order row highlight for better navigation. We will also modify the cancel button on the account detail form to show a confirmation prompt only when edits are made, and implement the ability to enter and calculate math equations directly in the pending field on a continuous form using a text field and the Eval function. This is part 7.
Transcript This is part 7 of my account balances series. Part 7 of how many? I'll figure it out when we get there. If you haven't watched parts 1 through 6 yet, go watch those first and come on back. You'll find links to them down below in the description field.

Today, we are going to fix a bug discovered by one of my students. Thank you very much. We are also going to change the background color of some of the fields if they have focus. That is always easy on the eyes to see where you are and what you are editing. We will always change the sort order field, which is the beginning of the row - this guy - so no matter what row you are on, no matter what you are editing, it will always have the row highlighted for you instead of just a little thing here in the record selectors.

We are going to add a cancel to the RU Sure button on the account detail form because I was adding an account and I accidentally hit the escape key and I lost my work. So I like an are you sure there.

Finally, we are going to add equations in the pending field. I did a video on this before but we are going to add it to this one and it is going to be slightly different because this is a continuous form, whereas before we did it with a single form. So there are a little bit different things we have to do here to handle this in a continuous form.

This is like in Excel where you can type in something like equals 100 minus 20 plus 14 and then have Access do the calculation for you. I like that in some of my databases.

A couple of prerequisites for you: first, go watch my highlight row video. In this one, I show you how to highlight the whole row across depending on whatever record you are on. Go watch this, so I do not have to repeat myself. And go watch this video - this is the one I mentioned where you can do math in fields. We could type in something like 5 plus 5 plus 5 plus 5 and it gives you 20. Now in this video, I only do it with a single form. In today's video, we are going to modify it so we can put it in a continuous form, which is a whole different ball game. So go watch those videos and then come on back.

First up, we have a bug report. Michael Johnson discovered that I have a little bug in my VBA code. I have "is an all pending then balance equals zero" and I just did not copy balance down. My brain was not firing on all cylinders when I recorded this video. I remember that day. It was a low caffeine day. So let's go fix that. That is going to be an easy one.

Let me switch over to the sample data. It is going to be in our DoReCalc function, which is right there - DoReCalc - and you can see there, I just copied this line. I forgot to use "pending" depending. That is all. Good catch, Michael. Thank you very much.

Next up, what I want to happen is as I am tabbing through my fields, I want the one that I am on to go yellow. It is just nice to see. Basically credit, balance, and pending - now, we are going to do some work with pending later where we have to change the conditional formatting - but we will just keep it simple for now.

Let us just click on this one, this one, and this one. Format, conditional formatting, new rule, field has focus, and let's make the background color yellow. Hit OK, apply, OK, close it, open it, and now you can see as I am tabbing, it is easier to see which one I am on.

Now in the highlight row video, I teach you how to highlight the whole row. I do not want to highlight the whole row here because I still want this color, but it would be nice if I am in this row to also have this sort order box highlighted. I just think it looks nice. Let's do that. Again, I covered this in highlight row.

What we are going to do is go to Design View. We need an unbound box in the footer to represent the current account ID that we are on. Just copy any one of these. I will copy this one, copy, click down here in the footer, and paste it. Did not go in the footer - click down here in the footer and paste it. There it goes.

I will just put it over here. We are going to make it invisible in a minute. Open up its properties, go to "All." Unbind it, so go in a sort order and make the name "CurrentAccountID." This will represent the ID of the record that we are on.

Now, how does it get that? It gets that in the On Current event. So click here, go to Event - On Current. Remember, On Current fires whenever you move from record to record. If you want to learn more about On Current, I should have put this in the prerequisite. Sorry.

So right here in form currently, On Current event, all we are going to say is CurrentAccountID (that is our unbound box) equals AccountID. So put in that box whatever record we are on.

Save it, come back out here. Let's close it, open it, and look right away, there is a 1 down here. See that? Click here, there is a 2. Now, that is not the sort order. Remember, this is the sort order. That is the ID.

There is a 29. That is Account ID 29. Now what we are going to do is we are going to say, for the conditional formatting for this box, if your ID matches that, then make this guy yellow too. Let me do that with "Expression Is."

So, click on you, format, conditional formatting, new rule, "Expression Is," and it is going to be AccountID (and you have to use your brackets here, unfortunately - this is one of those instances where we need brackets; otherwise, Access will convert those into a text string for you, which we do not want).

AccountID equals CurrentAccountID. Again, we will make it that bright yellow. Hit OK, apply, OK. Save it, close it, open it, and there you go. Notice whatever row you are in, you will get that right there. If you are over here, you still get that row highlighted.

Again, this is nothing new, I have covered this in previous videos, but I just want to add these bells and whistles to this thing.

What is up next? Let us see here. If I am editing one of these guys, and I make a change here and I hit cancel, I want an RU Sure there. But I do not want an RU Sure all the time, because they just use this to close the thing. In fact, what we could do is, when we open this, have this say "close." Then once they start editing, once the record goes dirty, let us change the caption to say "cancel." If it is dirty, when we cancel, we will ask, are you sure? So we do not have the prompt if they have not made any changes.

Let us go into here, Design View, and let us, by default, make this say "close." This is the cancel button, remember. Now when they first start editing, the "On Dirty" event is going to fire. Where is On Dirty? Right there. On Dirty means the record is being edited, and as soon as that happens, we are going to say CancelButton.Caption = "Cancel (Escape)" like it was.

That is all. Let them do their dirty work - see what I did there? Now when they actually click this button, we are going to ask them here first, if the record is dirty, "Are you sure you want to cancel?"

So:

Dim reply As Long

If Me.Dirty Then
reply = MsgBox("Are you sure you wish to cancel editing this record?", vbYesNoCancel, "Cancel Edit")
If reply <> vbYes Then
Exit Sub
End If
End If

If they say yes, it will continue on down here.

Save it, compile, close it, close it. I just open up an account and hit the close button - no harm, no foul. If I open the other thing and I start editing it, immediately that goes to the cancel button, and now if I say cancel, "Are you sure you wish to cancel editing this record?" If I say no, it stays there. If I hit cancel now and say yes, then it cancels. That is pretty cool.

That is the Dirty event and the Dirty property. Want to learn more about Dirty? Here is a video for you. I'll put a link down below. Dirty mouth. Clean it up with Orbit.

Next comes the big one: putting the math in the pending. Now, why do I put it in pending and not the other two? Because usually credit, that is your balance or your max. For a credit card account, that is your max available credit, and that changes very infrequently, and for your bank accounts - savings, checking, investments - you get one number for that. This guy does not change that often; that is your posted amount. For a credit card, that will be the posted transactions. That is one number. Same thing with these guys, usually. But pending can be a list of stuff. Credit cards, for example, or a checking account, it would be checks that you have written. They might come in a bunch at a time.

Now, most sites like Capital One, American Express, they will add them all up for you and give you a nice little sum. Amazon credit, which is run by Synchrony Bank, does not. I have actually emailed them and said, hey, can you just put a little sum in there? No, you go to your Amazon credit on Synchrony's site and you get all your transactions, but there is no total. Please, if anyone from Synchrony is watching this or Amazon, please tell someone to put a total on that screen.

What I have to do instead is, you know, you have five transactions, you either have to open up your calculator app and type it in, figure out the number, or guess. But I want to be able to just do that right here in Access. I want to be able to say, you know, what are my transactions? Minus 90, minus 120, minus 30, and then, boom, have Access do it. Can't do it yet because it is not a program, but usually that is something that I only do in the pending field. I do not need to worry about the other two fields.

Now, in the other video that I told you to watch before, we did it in a single form, which is easy because you can use an unbound text box for that. But you cannot do that here, because with a continuous form, if you change the value of an unbound field, it changes all of them; same thing with the color. If you change the color of an unbound field, it changes all of them, that is why we have to use conditional formatting for this. So we are going to need to use a bound field, which means we have to add a field to the table. But the only way we can get away with this is to use a text field.

So we are going to actually hide pending, and we are going to add a bound "pendingtext" text field. We are actually going to do the typing in that, then do the evaluation, save that in the pending field, and then make pendingtext equal to pending, just like we did in the other one, but this involves a bound field.

Another problem that we run into is that the format that we used in here with the red does not work with text fields. You get the parentheses for the negatives, but you cannot get the red, so we have to switch to conditional formatting for that.

So, a couple of things we have to do here first. Let us shut this guy down. Go to our sample data, open up accountT for design view. We are going to add, right after pending, here in the rows - I do not know if you guys can hear that, but there is a monster thunder going on, nice little afternoon storm here in Southwest Florida - pending, and yes, I have a battery backup, I am good - "PendingText," and leave that as short text.

Save it, open up, make it there, and pendingtext. Yes, we are going to have to run an update query in a minute to get all of these values over to here. In fact, let us do it now while I am here, but I want to note something. Let us just change a couple of values. Let me just put 50 in here and negative 2 in here.

Let us make an update query now to copy all this data over here. If you are still building this, and you only have a couple of records, you could just type these in by hand, but an update query will do the job, and I get to show you something new.

Go to Query Design, bring it in here, and yes, you can run queries in your back end database. This is fine. You do not have to do your queries in the front end, especially if this is just something you are doing once and you do not plan on saving it.

Change to an update query. If you do not know about update queries, by the time we get to the developer level, I assume you guys know all this stuff because I cover it in the expert classes.

We are going to be updating "pendingtext," and we are going to be setting it to - now, do not just put "pending" in here because if you just put "pending" in, oops, no - if you just put "pending" in here, with the brackets, any brackets here, pending, there we go.

If you just put "pending" in there, watch what happens. Let me run it. Take a look at the data. Look at that. It looks okay, the data is right, but it is not formatted like we like it. Now, in the form, I do not have dollar signs in my format in the form, but I do want the parentheses, so we have to put the format in here that we want.

We are going to update this to: Format([pending], "standard;("0.00")"). Do not put the red in here because it does not matter; the red will not work in a text field, it just does not.

Now when I run it, come over here and take a look, and now you have the parentheses around your negative numbers, which is good, that is how I want it to look.

Save this, close it. We do not need to save the query; we are not going to use it again. Save changes, no, close the back end. Go do it in any other fields, any other tables you have for other databases, like I have to go do Rix data.

Go back to your front end. Design view. First thing we are going to do is copy "pending," control C, control V. I will take the original and move it down here. That is the actual pending field. This is now going to be "pendingtext." Open that up, change this to "pendingtext," change its name, and you can get rid of the red off the format; it will not work here. If you do not believe me, watch. See, it does not work with text. I almost went over here and was like, wait a minute, no, it is right. Sorry. Get rid of that space.

We are going to hide both of these things in a minute, so do not worry about them being here.

Now we need the code in the "pendingtext" After Update. You can get rid of the After Update. Do we care here? Because we need an actual event. This is going to be just like the code we wrote in the other video, so if you want an explanation for all of this, go watch that other video again.

We need:
On Error Resume Next

If Left([PendingText],1) = "=" Then
PendingText = Right([PendingText],Len([PendingText])-1)
End If

Because a lot of Excel users are used to typing in that equal sign there, so we are just accommodating them, myself included.

Set Pending = 0; because if there is an error, we want a default value of zero to be in there, because this next item will error out if they type in some gibberish.

Pending = Eval([PendingText])

Remember, the Eval function will take any math equation that is valid, evaluate it, and then save that value in Pending. So 5 plus 5 plus 5, Pending will equal 15. If that errors out, Pending is still set to zero.

Now, once Pending has a valid value, we are going to say:
PendingText = Pending

That is what is different from the other one. We have to save that value in the table, because it is now in a continuous form.

Save it, close it, close it, move my database where it belongs.

Open it up, right here. 5 plus 5. Boom, there is 10. If you click here, you will see there is actually a 10 stored in the table, which we want. We still want the numeric value for doing all of our calculations. We are still adding that pending in with the rest of the stuff.

If I put in here minus 100 minus 200, bam, there we go. I just noticed that did not recalc, so we need to do Recalc in there too. Go back, here, DoReCalc. Save it, and one more time. Up here, go minus 500, there you go.

Now, to get that red color, again, it is a text field, we cannot use the format property, so we have to use conditional formatting. Design view, click on "pending," format, conditional formatting, add a new rule: if the field value is less than zero, set the text equal to red. Hit OK, apply.

The problem is going to be - and you will see this in a second with Access - unlike Excel, because Access is the red-headed stepchild, literally a redheaded stepchild of the Microsoft Office family. Microsoft spends a lot more time adding features to Word and Excel. I get it. Those programs have many more users. There are far fewer of us Access users, so I understand why Microsoft devotes the resources they do to Excel and Word and other stuff like that.

Because of that, conditional formatting in Access runs a little bit differently than Excel. In Excel, you can have it do multiple things and then have a stop condition. You cannot do that in Access. In Access, as soon as it hits a condition that is true, it is done.

So that is going to cause a problem because we are not going to get red on yellow. It is going to go yellow, and be black on yellow. This will never run if you have the focus.

Save it, close it, open it. All right. We got our red, it looks good, except I forgot the format for these guys. That is okay, we will fix that in a second. But look, if I click on there, that is black on yellow, this is red on yellow.

What I am going to do is, the easiest solution here is to make these guys black on yellow instead of red on yellow. Plus, I think it looks a little better too; the black on yellow is easier to read than the red on yellow.

So let us go in here, design view. With these two fields here, I am going to go to Format, get rid of that red from here, and we will control it with conditional formatting here. Format, conditional formatting. Do the same thing: new rule, field value is less than zero, make it red. So that way, they are all on the same page.

Save it, close it. All right, we got our reds, but now when you move, it is uniform. Yes, we lose the red when focused, but at least they are all the same.

Let us fix this, because I want that to be in parentheses, so we just have to apply that format when we save in the code. Again, get that format, copy that, go back to our code, and this needs to change right here:
PendingText = Format([Pending],"0.00;[Red](0.00)");

That ought to fix it.

Let us see what we got. Close it, open it, and we are going to have to rerun these, but minus 25. Boom. There we go. Minus 300. And we got a minus 20. Let us go minus 20 minus 15 minus 60 minus 1. Boom. Sweet.

Now all you have to do is come in here and hide these bad things. What I like to do, though, is when I have hidden fields like this, I like to make them a little bit smaller, and I try to keep them together. What I will do is, I will make their format - I like to make them black text with red background so in Design View, they visually pop up, but in Form View, they are hidden. The user does not see them, but their values are still there because we need them.

If I go into Design View, I can very easily see there are some hidden fields there. That is why I do it like that. I used to, when I first started working with Access, make them really, really tiny and shove them in the corner and make them invisible. But then when you go back to Design View, it is impossible to find them. Yes, you could use the little guy up top here - you could use this thing to find them - but I like my way.

In today's extended cut, we are going to optimize the sorting stuff that we did in yesterday's extended cut. The up and down buttons to move these things up and down - we are going to make it a whole lot faster, and we are going to make it so that when you manually change one of these, it is faster. I came up with a new technique after I recorded yesterday's video. So yesterday's video is still cool, it is still good, it still works, but today we are going to just optimize it a little bit.

You can see now, click on this guy, go up, up, up, up, it moves a lot faster, but kind of flickers a lot more too. So, that is what we are doing in today's extended cut.

Silver members and up get access to all of the extended cut videos. Gold members can download my databases from these videos, and you can access the code vault and all kinds of stuff. You get a free expert class every month after you finish the beginner classes and lots of stuff, so check it out. Join today.

That is going to be your TechHelp video for today. Hope you learned something. Live long and prosper, my friends. I will see you next time.
Quiz Q1. What was one of the main bugs discussed and fixed in the video?
A. The DoReCalc function did not update the balance correctly due to a missing reference to the pending field
B. The background color would not update when focusing on a new field
C. The form would not save changes to the database
D. The sort order would not update when new records were added

Q2. Why did the presenter want to change the background color of fields when they have focus?
A. To prevent users from editing fields accidentally
B. To visually indicate which field is active and being edited
C. To group related fields together for printing
D. To make the form run faster

Q3. Which field's background color is set to change for the entire row regardless of which field is edited?
A. The account balance field only
B. The pending field only
C. The sort order field at the beginning of each row
D. The record selector only

Q4. What is the purpose of the "CurrentAccountID" unbound box in the footer of the form?
A. It stores the total pending amount for each account
B. It displays the user's name
C. It represents the ID of the currently selected record for conditional formatting
D. It holds the sum of all accounts in the database

Q5. Which form event is used to update the CurrentAccountID when switching records?
A. AfterUpdate
B. OnChange
C. OnCurrent
D. OnOpen

Q6. What modification was made to the "RU Sure" button on the account detail form?
A. It was removed entirely
B. It now always shows a confirmation prompt, whether the record is dirty or not
C. It shows a confirmation prompt only if the record has been edited (is dirty)
D. It duplicates records before closing the form

Q7. In the context of this video, what does it mean when a record is "dirty"?
A. It contains invalid data
B. It is being edited but not yet saved
C. It is missing required fields
D. It has been deleted

Q8. Why is the ability to enter equations (like '=100 - 20 + 14') only added for the "pending" field and not credit or balance?
A. Credit and balance rarely change, but pending can involve many small or variable transactions
B. Credit and balance are always zero
C. Pending field only stores text
D. Equations are needed for all fields, but pending was chosen arbitrarily

Q9. Why can conditional formatting be problematic with continuous forms in Access?
A. It cannot be used at all in continuous forms
B. Once a condition is met, no subsequent rules are evaluated for that field
C. It only supports one color per database
D. It always requires code, not expressions

Q10. In making the equation entry for pending work with continuous forms, which of the following is NOT true?
A. A bound text field named "pendingtext" was added to the table
B. The red formatting for negative numbers was moved to conditional formatting
C. The equations are evaluated using VBA's Eval function
D. Unbound controls can be used in a continuous form for per-row input

Q11. What happens in the code when a user starts an entry in pendingtext with an equal sign (=)?
A. An error message appears
B. The equal sign is automatically removed before evaluation
C. The field displays zero
D. The calculation is skipped

Q12. Why must the result of the equation in pendingtext be saved back to the pending field?
A. The pending field is not used in calculations
B. The user does not need to see the result
C. The pending field still stores the actual numeric value needed for calculations
D. It is a required field for all tables in Access

Q13. When copying old pending values into pendingtext, why is a specific format ("standard;("0.00")") used in the update query?
A. To ensure all values are negative
B. To add dollar signs automatically
C. To display parentheses for negative numbers, as red formatting will not apply in a text field
D. To uppercase all characters

Q14. Why did the presenter choose to make hidden fields small and color-coded in design view?
A. So they are visible and easily found in design view but hidden from users in form view
B. To prevent users from accidentally deleting them
C. To save space in the database
D. Because Access requires hidden fields to be colored

Q15. What limitation does Access have with conditional formatting that differs from Excel?
A. Access does not support numbers in fields
B. Access can only apply formats based on the first true condition for a field, not multiple
C. Access always shows all conditions, regardless of order
D. Access automatically applies an "Are You Sure" dialog to all changes

Answers: 1-A; 2-B; 3-C; 4-C; 5-C; 6-C; 7-B; 8-A; 9-B; 10-D; 11-B; 12-C; 13-C; 14-A; 15-B

DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.
Summary Today's TechHelp tutorial from Access Learning Zone covers part 7 of my ongoing account balances series. If you have not watched parts 1 through 6 yet, I recommend you do that first in order to have all the necessary background. You can find links to those previous parts below this article.

Today, I will be addressing a bug that one of my students found, as well as making some visual improvements and functional changes to the account balances form. Specifically, I will show how to change the background color of fields when they have focus, making it easier to see which record and field you are working with. The sort order field at the start of each row will always have a highlighted background, regardless of which field you edit within a row. This provides a clear visual cue for editing, beyond the standard record selector in Access.

I will also be updating the "Are You Sure" (RU Sure) button on the account detail form. The current behavior caused me to lose work by accidentally pressing the escape key during data entry. By modifying this, I will ensure users get prompted to confirm if they really want to cancel any unsaved changes.

Another feature I will add is the ability to enter math equations directly into the pending field. This is similar to how Excel lets you type in something like =100-20+14 and have the system calculate the answer. I previously made a tutorial on field math for single forms, but today I will show how to handle this within a continuous form, which requires a different approach.

There are a couple of prerequisite lessons that I advise watching for full understanding: one on highlighting rows in continuous forms so users can see which record is selected, and another about performing math in data fields. In the earlier lesson, equation entry was demonstrated with a single form, but today the methods will be adjusted for use in a continuous form.

To start, I have a bug to fix. One of my students, Michael Johnson, reported that my VBA code in the DoReCalc function did not copy the balance down properly when "all pending" was true. This resulted from a simple oversight in the code logic which is easy to correct. I appreciate students catching things like this and letting me know.

For the field highlighting improvement, the goal is for the active field under the cursor to be visually distinct—showing a yellow background for fields like credit, balance, and pending as you tab through them. This is achieved using conditional formatting by creating a rule that triggers when the field has focus. Applying this makes it much easier to identify the current field while editing.

Additionally, I want the sort order field at the start of each row to highlight for the current record, regardless of which field has focus within that row. To do this, we need an unbound box in the form's footer representing the current account ID. By updating this value using the form's On Current event (which triggers whenever you move from record to record), we ensure the sort order field knows when it should highlight using a conditional formatting rule that checks if its ID matches the current account ID.

For the cancel functionality, I am enhancing the existing "close" button on the account detail form. It will start labeled as "close," but as soon as a record is edited (triggering the Dirty event), the button's label changes to "cancel." If the user tries to cancel unsaved changes, a confirmation dialog appears, ensuring edits are not lost by accident. If there are no unsaved changes, closing proceeds as usual with no interruption.

Now, let's talk about performing math directly in the pending field. Typically, I reserve this for the pending field because credits and balances usually change infrequently and represent single numbers (such as the maximum credit or the current statement balance). Pending, in contrast, often involves multiple transactions. For example, many credit card or checking accounts will have several outstanding transactions, and not all banks sum these values for you automatically. I wanted to make it easy to enter and sum them right in Access.

Handling equations in a continuous form is more involved because any changes to an unbound field or its formatting will affect all records in that view. Because of this, we must use a bound text field—so I add a new PendingText field to the underlying table. PendingText will be used for data entry in the form, while the validated numeric value will be stored in the Pending field after calculating the result. This setup allows each record in a continuous form to maintain its own value.

Conditional formatting also works differently in Access compared to Excel. For example, formatting for negative numbers in a text field (with parentheses and red color) is not supported in the same way, so I use conditional formatting rules to set the color instead. I demonstrate formatting rules that, for instance, show negative numbers in red text. However, Access does not support stop-if-true logic in its conditional formatting, so if multiple conditions could apply, only the first true rule will be used.

To copy existing Pending values to PendingText, I use an update query. This is helpful if you already have data, but if you only have a few records during setup, you can simply type them in. Once the new field is in place, I add logic so that after entering an equation in PendingText, Access evaluates the expression using the Eval function. If the expression is invalid, Pending is set to zero as a default. Once the calculation is complete, PendingText is updated with the formatted result, ready for display.

To further clarify which controls area are for display and which are hidden for logical processing, I use visual cues in the Design View: black text on a red background. This does not affect what the user sees in Form View, but it makes it easier for me to spot the supporting fields when editing the form layout.

In today's Extended Cut, I will also be optimizing the sorting functionality I discussed in a previous lesson. I have developed a new technique that makes moving records up and down faster and more responsive. The new approach significantly improves speed, but you may notice more flicker. This improvement builds on the method introduced in the earlier extended cut, so you may want to review that for context.

Remember, all Silver members and above get access to my extended cut lessons, and Gold members also have access to downloadable databases, the code vault, and a monthly free expert class after completing the beginner series.

For a complete video tutorial with step-by-step instructions on all the improvements and concepts described here, visit my website using the link below. Live long and prosper, my friends.
Topic List Fixing a bug in the DoReCalc VBA function
Adding conditional formatting for field focus
Highlighting the sort order field based on current row
Using an unbound control to track current AccountID
Applying conditional formatting with Expression Is for row highlighting
Changing the Cancel button caption when editing
Using the On Dirty event to detect record changes
Prompting Are You Sure on cancel when a record is dirty
Adding equations to the pending field in a continuous form
Creating a PendingText field as a bound text box
Migrating existing pending values to PendingText using an update query
Formatting negative amounts with parentheses in PendingText
Writing code in PendingText AfterUpdate to handle equations
Utilizing the Eval function to process math in PendingText
Updating Pending and PendingText fields programmatically
Applying conditional formatting for negative values in text fields
Managing conditional formatting conflicts for field focus and red text
Formatting PendingText with parentheses for negatives
Hiding bound fields in form design for clarity
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 2/16/2026 9:16:33 PM. PLT: 2s
Keywords: TechHelp Access On Dirty Event, Dirty Property, change background color of field on focus, change background color of another field on focus, are you sure cancel button, equations in fields in continuous forms, optimize sort with recordset  PermaLink  Account Balances in Microsoft Access, Part 7