Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Eclipse Timer 3 < Eclipse Timer 2 | SQL Syntax >
Eclipse Timer 3
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   2 years ago

Create Real-Time Eclipse Timer in MS Access, Part 3


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

In this Microsoft Access tutorial, we'll scale celestial movements in an interactive Real-Time Eclipse Timer based on the duration and location of an eclipse, complete with dynamic visuals and a countdown timer. Learn to calculate time differences, update visuals on the fly, and utilize form timer events. This is part 3 of 3.

Members

There is no extended cut, but here is the database download:

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

Links

Recommended Courses

Eclipse Timer Series

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.

KeywordsEclipse Timer in Microsoft Access, Part 3

TechHelp Access, eclipse timer, interactive timer, real-time animation, dynamic form, celestial objects report, moon transit animation, eclipse progression, Access tutorial part 2, calculating eclipse timing, celestial event simulation, custom eclipse tracker, VBA date diff, Access form timer event, RGB colorchange

 

 

 

Comments for Eclipse Timer 3
 
Age Subject From
2 yearsRounded Form EclipseJeffrey Kraft
2 yearsEclipse TimerKevin Robertson

 

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 Eclipse Timer 3
Get notifications when this page is updated
 
Intro In this video, we continue building the Eclipse Timer in Microsoft Access by adding animation to the Moon, calculating the timing and duration of eclipse phases, and using variables to track elapsed minutes. We work through the math needed to move the Moon graphic based on user input and time, utilize the DateDiff function in VBA, and update form and report visuals for more accurate representation. The tutorial also covers enhancing user interactivity with button controls, switching colors during totality, and enabling real-time updates with a form timer event for live eclipse simulation. This is part 3.
Transcript This is part 3 of my Eclipse Timer video series where we're making an Eclipse Timer in Microsoft Access. If you haven't watched parts 1 & 2 yet, go do that now. What are you doing here? Go watch those. Come on back.

Alright, so we got our form set up. We got our little report set up. We got a Sun. We got a Moon. Now we got to make this thing move. Now, let's figure out where partial begins and partial ends. The partial would begin right when the disk of the Moon is touching the disk of the Sun. So let's come back over here. Let's set up two more variables.

Constant partial begins. That's got to be some number. I'm going to say let's try 4000, 2000 pixels. The radius is 1,000. So from the center to the edge is 1,000. So we want this circle to be right up against this one so it's probably going to be another 1,000 away from it, a total of the diameter is 2,000. So I'm thinking 4,000 would be good. And then if we've got partial ends on the other side, right, this would be 8,000. So let's draw the Moon at where partial begins. Save it, come back over here, hit the button. Look at that, it's close.

Now, it's not exactly perfect because again, remember we changed the size here. We made the Sun a little bit smaller because the Moon's closer. Save it there, it fits perfectly. Okay, but I'm going to say, let's leave this 1,000 for now. We'll tweak it later. We'll go with perfect spheres for now. We'll be the Greeks and Romans, the universe, the celestial perfect spheres.

Now here's where the tricky math comes in. Basically, I want to move this Moon left or right based on the number of minutes that have elapsed since partial begins. So we're going to take this time and then we're going to add to the x value of this circle based on how much time has passed since this spot here. Now, how do we know how much time has passed? Because based on your location these times can be different. You might not have the same amount of totality or even partiality as from one location to another. So what we have to do basically is we have to take the partial ends, subtract the partial begins, and that will give us the total duration of the eclipse. Then we can divide that up by our scale, however many pixels we're dealing with, and that's how many pixels we can either add to or subtract from this x coordinate based on the current time. I know it sounds crazy, but you'll get it. You'll see what I mean. Basically, we're scaling our drawing in and out based on the time that we need.

Alright, so we're going to need some more variables in here. So dim minutes difference, that's going to be how many minutes are there between the ending and the beginning of the eclipse. Alright, that will be a long. We're going to need our pixel scale, okay, that's going to be the pixels of where the circles are going to be drawn divided by the number of minutes. Okay, so if we have to move a thousand pixels in a hundred minutes, that scale will be ten. See what I'm saying? Alright, that's also going to be a long. And then we'll need our minutes elapsed, also is a long. So we know how many minutes have elapsed from the current time from the beginning of the partial eclipse. Okay, now minutes diff is going to be equal to date diff. And if you don't know how to use date diff, I got a tutorial on that. You'll find a link down below.

Alright, number of minutes between the partial and the partial beginning and the partial ending and those values can be found on the form. Alright, so it's forms, main, menu, F, and I'm just going to copy this so I don't have to keep retyping it. Alright, partial begins, comma, partial ends. Let me slide this over so you can see the whole thing. Okay, so that's the total minutes difference between the beginning and the ending of the eclipse. That's the basis for our scale. Now the pixel scale is going to be the total size of the eclipse in pixels across my report. Okay, so it's going to be partial ends minus partial begins and divide that whole thing by minutes diff. So now I know based on the size of my report, based on the size of the field where the circles are being drawn. Take the total size of that, one minus two. And then divide that by the minutes difference. So I know how many pixels you have to go across each minute. And again, it's not exact. We're not going into, you know, fractions here. It's close enough.

Now, we also need to know the minutes elapsed which is going to be, I'm going to copy this guy because it's very similar to this. So we're going to copy this. It's going to be the minutes elapsed from partial begins to the current time. So I know how many minutes have elapsed. Okay, are you with me so far? This will make a lot more sense when it's done. You'll be able to go through, watch it again, and you'll see what I'm talking about each step of the way.

Now, essentially what I have to do is come down here for my moon circle, okay, and I'm going to say move it to partial begins plus some value here which represents the minutes that are elapsed times my pixel scale. So if one minute is elapsed, move it one unit over which is my pixel scale. It could be 24 pixels per minute or 30 pixels per minute depending on how quick the eclipse is. So, it's basically going to be minutes elapsed times the pixel scale. And that could be a negative value too. You're going to watch the moon move left and right. And fortunately for this, we don't have to worry about out of bounds errors. We don't have to worry about it going too far to the left or to the right. At least what I tested didn't.

OK, you ready? So we know the minutes difference between the partial and the end, the partial beginning and the partial ending. We know the size of the report. Then we can now figure out how many minutes have elapsed and how far across we have to go for each minute of the eclipse. Save it. Always good to throw in a debug compile.

Are you ready? Now we're going to start this at 12:23. Okay, I'm going to add a minute and I should watch the moon move to the right just a little bit. Okay, look at that. Do it again. A little bit more, look at that, see? Isn't that cute?

Alright, let's put show eclipse in our buttons here. I'm going to go back to my code here, go to the main menu. That's why I want to put show eclipse in here. So each time we hit these buttons, right, the add a minute didn't do show eclipse and then we're subtract a minute right down here, show eclipse. So we have to keep hitting two buttons. Ready? Click. Click, see, look at that. Yeah, that's pretty cool, huh? There you go. Let's bring it closer to totality. So at 13:40, let's bring this up to 13:30 and show eclipse, almost covered and that it should be totally covered. And again, this is why I before I said let's cheat and change the size of the Sun just a hair, I think I put this at 9:40 in my calculations, and that came up pretty good toward the totality point there. There we go.

Alright, so you back it up and you can still see a little bit of it. Okay, and it should come out the other side. Totality ends at 13:44. So 42, 43, 44, and 45. You're going to start to see it back on the other side. There you go. Okay, that's pretty cool, huh? And 12:23, let's show that again. It's a slight tiny bit off there on the side, you get a... And this is, this is perfect. You're not going to be using this in your astronomy lab, but this is just for entertainment purposes only, kids. Actually I haven't, you might get better results keeping the sun about making the moon a little bit bigger, but uh...

Another thing that I like to do is during totality, let's flip the colors. When this guy actually crosses the Sun, if we're at 13:39. You could put the show eclipse in the after update event for this too if you want to. When this guy actually goes over the Sun, let's flip the colors a little bit. Right after we draw the Sun, we'll say totality is here. Okay? So we're going to say if, nope, I want my forms, I want this thing, I thought that was still in my clipboard, let's copy that back again.

If the current time is greater than or equal to totality ends, then we're going to do some stuff, else do some other stuff. What are we going to do? Well, we're going to flip the color of the Moon. Let's make it like a light gray. All right, let's say me.fillcolor, that's the color of the Moon because we haven't drawn the Moon yet at this point equals. I'm gonna go RGB (230, 230, 230), that's all really light gray, almost white—remember 255 is white for all three of those. RGB (230) is just a little bit less than that. And while we're at it, let's also make the background color of the detail section black on the report so me.section(0), that's a detail section, dot backcolor equals vbBlack. Right? Otherwise, it's normal.

So me.fillcolor equals vbBlack and then me, I'm just going to copy this instead of retyping it, me.section(0).backcolor is going to be vbWhite. Okay? Save it. Come back out here.

Alright, we're not quite to totality yet. Ready? Click. One more, click, and oh, what happened? We're not getting our Moon. Where's our Moon? Let's see here. Hold on. Let's go back. Let's check it out. Ah, look it. I found the problem. Anybody see it? I still got this guy down here, so no matter what happens, that's overriding it. Alright, so get rid of you. Alright, save it, come back over here and boom, there's my totality. Yay. And if you want, you could maybe make this dark and, you know, make a smaller circle inside of it that represents the Aurora, whatever you want to do, not the Aurora, the Corona.

Alright, and then as you move it across you move it across you move it across you move it across and time to put those goggles back on kids don't look at the Sun unless you're in totality and I plan on having a little stopwatch on my phone for about three minutes and whatever so it beep beep beeps like five seconds before you put your glasses on alright and like I said before you can do something like this if you want to do. I come in here and say it's eleven o'clock and then show eclipse you'll see the sides way over here thing it'll go pretty far. I've been trying to help her at three AM they want to show it up on the page yeah it doesn't give you an error if it's way over the last year I can see it right to go to eleven o'clock and there.

Alright, one more thing and then we're done. What if you want to follow this thing in real-time? You want this to actually move across the screen in real-time. Well, we can use a timer, a form timer event for that. Okay. I'm going to put a checkbox on my form and let's make this white and we'll call this real-time. This guy here. And of course, I'll be disappointed in you if you're in the Eclipse totality path and you're watching this database during the actual Eclipse. I won't be.

Alright, default value let's say no, you got to turn it on manually. Alright, now when the user checks this box we're going to activate real-time mode. So go to Events, go to After Update, dot, dot, dot. Okay, what are we going to put in here? Well, if real-time, in other words, they just check the box on, then me.timerinterval equals, let's do 60 seconds. You can do 10 seconds. You can do whatever interval you want. For the purposes of class, I'll do 5 seconds, 5000, so you can see it running. Normally I would set this to like 60 seconds. Okay? So this will be 5 seconds. Remember, these are milliseconds. And if you don't know how to use the timer interval, I got lessons on that, too. I'll put a link down below here. Let's see. Timer. I'll put that in the links section.

Okay? And then we want to say otherwise me.timerinterval, interval equals zero, turn the timer off, which is the default setting. Now, the timer interval will fire the timer event from the form. So come to the form's properties, scroll down until you see the timer interval, leave that zero because we want it to start off. And now the on timer in here, we're going to say the current time equals. I'll put the current time in there. There's a lot of different ways you can do it. Here's the easiest way. Now minus date. Because now gives you the current date and time, and we're just going to subtract the date from it, which is the current date at midnight. So what you're left with is the time. You can use timeserial. You can use all kinds of other tricks. That's my way of doing it.

Okay, and then when this kicks off, we're going to show Eclipse, so it updates. Okay, and in this case, it's every five seconds. I suggest setting yours to every 60 seconds. It's not going to matter. 60 seconds is the interval you're going to get anyway. Save it. Debug compile, which we haven't done in a while. Come back out here. Close it. Close it. Close it. Open it. And let's go to real-time now. It's currently 5:56 PM so that's going to change it in five seconds to that. That's nowhere near the Sun. Let me turn that off. You can see it's working every five seconds. Let's cheat though. Let's make another location. Let's just call this Rick World. And let's say that partial begins at 17:00, totality begins at 17:58, maximums at 18:00, totality ends at 18:02, and the partial ends at 19:00. Alright. And then we'll go show eclipse. We're near it.

Hit real-time and every 5 seconds that should update. And you should see it should update to 57. There we go. It's getting even closer. Obviously the time's not going to change but yeah. It's working. We got to wait a minute for totality to kick in. And there it goes. Good enough. You can see a teeny tiny bit of it over there. We can make adjustments. But that's it. That's how you build an Eclipse Timer. I think it's pretty cool. And yeah, there's a lot you can do with this. I just threw this together in an afternoon, but there are all kinds of enhancements and updates and changes and stuff you can make to it. I encourage you to play with the Legos and have fun and do something on your own that you think I'd be impressed with and then you're going to post it in my forum so I can see it. Show me some screenshots. But there you go. I hope you enjoyed my little Eclipse Timer series. Hope you learned something. That's your TechHelp video for today. Live long and prosper my friends. Go watch the Eclipse safely and enjoy it if you're in the path. And if you're not, watch it on TV. But that's your TechHelp video for today. I'll see you next time. Live long and prosper. Bye-bye.

TOPICS:
Creating an Eclipse Timer in Microsoft Access
Setting up form and report for the Eclipse Timer
Calculating when partial eclipse begins and ends
Introducing constant variables for eclipse calculations
Adjusting the size of celestial bodies for visual accuracy
Implementing the mathematical formula for Moon movement
Determining time elapsed since partial eclipse begins
Handling different eclipse durations based on location
Calculating pixel scale for eclipse visualization
Assigning variables for minutes difference and pixel scale
Utilizing the DateDiff function in VBA
Accessing form values programmatically
Animating Moon's movement based on minutes elapsed
Integrating variables into Moon's X coordinate calculation
Debugging and compiling VBA code
Testing Moon's rightward movement in form
Adding functionality to show eclipse progress in buttons
Simulating the eclipse's progression towards totality
Adjusting celestial body sizes for realistic totality display
Ensuring eclipse representation emerges from totality correctly
Visualizing slight offsets during partial eclipse stages
Switching colors during totality for enhanced effect
Correcting code logic to fix display issues
Adding real-time functionality with form timer event
Setting up conditional formatting based on eclipse stages
Using form timer to animate eclipse in real-time
Programming checkbox to activate real-time movement
Understanding timer interval settings for form events
Displaying current time with VBA for time-driven actions
Testing real-time updates with custom location data
Quiz Q1. What is the primary goal of the Eclipse Timer in Microsoft Access?
A. To accurately predict the weather
B. To display the current time and date
C. To visually simulate the movement of the moon across the sun during an eclipse
D. To calculate the distance between the sun and the moon

Q2. What was used to define when the partial eclipse begins and ends in the tutorial?
A. Exact velocity measurements of the moon's orbit
B. The number of minutes passed since the last full moon
C. Specific pixel values representing the positions on a form
D. The geographical location of the observer

Q3. How is the total duration of the eclipse determined in the program?
A. By calculating the distance between the sun and moon
B. By looking up historical data of past eclipses
C. By subtracting the 'partial begins' value from the 'partial ends' value
D. By using a fixed value regardless of location

Q4. What is the 'pixel scale' variable used for in the tutorial?
A. To scale the size of the sun and moon graphics
B. To calculate the ratio of pixels to the number of minutes for the eclipse's duration
C. To set the resolution of the display screen
D. To adjust the color intensity of the graphic elements

Q5. Which function is used to determine the number of minutes between two times?
A. TimeDiff
B. DateDiff
C. MinuteScale
D. TimeScale

Q6. What happens in the tutorial when the real-time checkbox is activated?
A. A message box displays the current time
B. The timer event gets triggered at set intervals to update the eclipse animation
C. The database closes automatically
D. The checkbox changes color to indicate that real-time tracking is enabled

Q7. What visual change is made to the simulation when totality of the eclipse occurs?
A. The sun turns blue
B. The moon's fill color changes to a light gray and the background becomes black
C. The eclipse timer stops counting
D. All form elements become hidden

Q8. What type of value is expected for the 'minutes difference', 'pixel scale', and 'minutes elapsed' variables?
A. String
B. Boolean
C. Date/Time
D. Long Integer

Q9. According to the tutorial, why is it not necessary to handle out-of-bounds errors for the moon's movement?
A. The moon's movement is restricted by the form boundaries
B. The calculations ensure the moon stays within the visible range
C. The moon's position is a fixed value and doesn't change
D. The tutorial didn't provide explicit error handling for the moon's movement

Q10. Which is the correct method to update the form at real-time intervals as per the tutorial?
A. Setting the form's onload event to update every second
B. Creating a loop in the code that refreshes the form continuously
C. Using a timer event with the time interval set by the user selection
D. Manually refreshing the form periodically by clicking a button

Answers: 1-C; 2-C; 3-C; 4-B; 5-B; 6-B; 7-B; 8-D; 9-B; 10-C;

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 continues the Eclipse Timer video series, focusing on building an Eclipse Timer application in Microsoft Access. If you haven't already watched the first two parts of the series, I recommend going back to those before proceeding, since we'll be building upon what was previously covered.

At this stage, we've set up the form and the report for our Eclipse Timer. The graphical representation now includes both the Sun and the Moon. The next step involves simulating the movement of the Moon across the Sun to mimic the eclipse's progression. Specifically, we need to determine when the partial eclipse starts and ends. The partial phase begins when the edge of the Moon's disk first touches the Sun's disk. To achieve this, I introduce two constants representing the points where partial begins and ends, using pixel positions. Given a radius of 1,000 pixels for these circles, a logical value to position the Moon right next to the Sun is 4,000 pixels. For the end of partial, that would be 8,000 pixels, which mirrors the arrangement on the other side.

After plotting the Moon at the starting position for the partial eclipse and testing it, the visual alignment looks pretty good, even after accounting for slight adjustments to the size of the Sun to reflect the true astronomical scale. For now, we use perfect spheres with equal radii, which suffices for our purposes at this stage.

The next task is moving the Moon left or right based on the number of minutes since the partial eclipse began. To do this accurately, we calculate how much time has elapsed from partial begins, and use that duration to adjust the Moon's X coordinate. Since eclipse durations vary by location, the timer must be flexible. This means taking the difference between the partial end and partial begin times to get the total eclipse duration. By scaling this time difference to the number of pixels available on our report, we can determine how far the Moon should move for each elapsed minute.

To manage this, I declare several variables, such as the minutes difference between partial ends and begins, the pixel scale to relate time to distance, and the minutes elapsed since the start. The DateDiff function is used to calculate how many minutes separate the beginning and end of the partial eclipse, using values obtained directly from the form fields. By copying the relevant data source references, I minimize typing errors and make the code easier to maintain.

The pixel scale is then calculated as the total pixel range divided by the minutes difference. This gives a conversion factor for how many pixels the Moon should move per minute. The minutes elapsed is similarly determined, measuring from partial begins to the current time value selected by the user. With these calculations, all that's left is to apply this to the Moon's X coordinate, multiplying the pixel scale by the number of minutes elapsed to determine its position.

Testing this logic, I simulate minute-by-minute updates and watch the Moon move incrementally across the report. I tie the movement to the form's buttons, so that each time a minute is added or subtracted, the Moon moves accordingly. This allows for an interactive demonstration, where users can see the eclipse progress frame by frame, even all the way to totality.

For visual accuracy, I tweak the Sun's size slightly for a better totality effect. As the Moon moves across and reaches complete coverage, totality occurs. This is reflected graphically: as the eclipse progresses past totality, the Moon emerges from the other side.

To enhance the visual experience during totality, I flip the colors: when totality is detected, the Moon is rendered as a light gray, and the background switches to black. This is done immediately after drawing the Sun, and conditional logic determines whether the current time falls within the totality phase. Once totality ends, the original colors are restored. Any display logic errors encountered during testing are corrected by ensuring that the color changes do not get overridden farther down in the code.

For added realism, I introduce a real-time mode. By adding a checkbox to the form, users can activate this feature, which uses the form's built-in timer event. When real-time is enabled, the timer interval is set to periodically update the display, for example, every 5 or 60 seconds. The timer event then updates the current time and redraws the eclipse, reflecting real or nearly real-time progression. This periodic update is controlled directly from form properties, and the logic for calculating the current time leverages simple date arithmetic in VBA.

After verifying the real-time operation with test data, including custom locations and time spans, I see that the Moon moves correctly and the display responds as expected. This means the Eclipse Timer is successfully simulating both manual and automated eclipse progression, with visual feedback for every stage.

All in all, this project illustrates how to apply mathematical and programming concepts to create an engaging simulation in Access. You're encouraged to experiment with the setup, explore other enhancements, and share your results. This timer is for fun and educational enjoyment, not for rigorous scientific measurement, but it demonstrates what you can achieve with creative thinking and a little VBA.

For a complete video tutorial with step-by-step instructions on everything covered here, visit my website at the link below. Live long and prosper, my friends.
Topic List Creating an Eclipse Timer in Microsoft Access
Setting up form and report for the Eclipse Timer
Calculating partial eclipse start and end points
Defining constants for partial eclipse positions
Adjusting Sun and Moon sizes for accuracy
Coding Moon movement based on elapsed time
Calculating total eclipse duration from form input
Computing pixel scale for drawing eclipse stages
Assigning variables for minutes difference and scale
Using DateDiff to find elapsed eclipse time
Accessing partial times from form controls
Calculating Moon's position for given time
Animating Moon's movement in response to time
Integrating eclipse progression into button actions
Displaying Moon movement as minutes change
Simulating eclipse approach to totality
Updating display to reflect totality visually
Flipping Sun and Moon colors during totality
Correcting display logic for totality transitions
Adding real-time animation with form timer event
Programming checkbox to activate real-time mode
Setting timer interval for real-time updates
Displaying time-driven eclipse transitions
Testing real-time eclipse update with location data
 
 
 

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: 3/14/2026 10:13:32 PM. PLT: 2s
Keywords: TechHelp Access, eclipse timer, interactive timer, real-time animation, dynamic form, celestial objects report, moon transit animation, eclipse progression, Access tutorial part 2, calculating eclipse timing, celestial event simulation, custom eclipse tra  PermaLink  Eclipse Timer in Microsoft Access, Part 3