Courses - Microsoft
Access 324 very strongly recommended|
Synchronize Tables, Student Attendence, Count Absences, Form Cycle, Weekends
This course is valid for Access 2000 through 2003.
If you are using Access 2007 or 2010, you will still benefit from this course.
You will find that the concepts are the same, but there are cosmetic differences between the versions.
Order before 10/24/2018 to
get a FREE upgrade to our
Access 2010 version!
Click here for details
The first half of this class is about keeping two
databases synchronized. Perhaps you have an office database and a
copy on your laptop - you want to keep them both in synch. We will begin
by talking about database replicas and why I don't like them. So
we'll write code to handle this ourselves.
We'll make two different customer tables,
and have our VBA code detect any changes between them - either different
or new records.
We'll create a form with two subforms so you can
see changes between the tables. This would happen if, say, you changed
the database on your laptop and someone else changed the office database
at the same time. Now you have a conflict to resolve.
We'll make a button to bring any changes
in customer table 2 into customer table 1. We'll also make a button to
import any NEW records that were added.
Now we'll move ahead to student attendence.
We'll make a simple student table. Then we'll make a form with a
mult-select listbox on it so we can select the students that were
absent, enter the date, and then with one click mark them all absent.
You'll learn how to determine which days are
weekend days. We'll also make a table with allowed school holidays,
so we can exclude those from our date calculations when figuring out how
many days students have missed.
Knowing this, and what the first and last days of
school are, you'll be able to calculate the number of days each
student was in school.
Access 325 - Course Outline
1. Compare Two Tables, Part 1
Synchronizing Two Tables
Detecting Changed Records
2. Compare Two Tables, Part 2
ListBox to See Different Records
Change SubForm Data in VBA
3. Compare Two Tables, Part 3
Detecting New Records
Find Unmatched Query Wizard
What Does Unmatched Wizard Do?
Change RowSource of ListBox
Importing New Records
4. Student Attendence, Part 1
Tables to Track Students & Days Absent
Multi-Select Listbox to Pick Students
Recordset to Add Absent Days
Table to Track Days Off (Holidays, etc.)
Aggregate Query to Count Absent Days
Public Function DaysInSchoolYear
5. Student Attendence, Part 2
DLOOKUP Start / End of School Year
Loop Through All Days
Count School Days
Exclude Weekends, Days Off
View > Immediate Window
Testing Function Return Values
6. Student Attendence, Part 3
Count of Absent Days Query
Show Days In Class (Subtract From Total)
Placing Start / End School Year in Table
Showing Days Attended up to Any Date
Form Cycle: Current Record Only
Saving Data To Table (Refresh) AfterUpdate
Button to Display Student Query
Microsoft Access 325
Richard on 1/1/2008:
Compare two tables, replication, Student Attendance|
Harry Mullin on 3/27/2009: You mention that START OF SCHOOL YEAR is in UC because "we are going to look for it in code". Does setting the case help the speed of DLookup? Case doesn't seem to make a difference in the where clause of dlookup. Have I missed something?|
Harry Mullin on 3/28/2009: Note on the DaysAbsent query: the nz function has an additional parameter which can be used to specify zero. Left off, it returns nothing.|
works to avoid the isnull workaround.
Harry Mullin on 3/28/2009: Strange result: In the query |
for DaysInSchool just to see what would return.
With AbsentReportF showing 188 days, I get 1/4 (?!)
Any idea why this happens?
Harry Mullin on 3/28/2009: What is the distinction among Refresh, Requery, and Recalc?|
I tend to find Requery is the only one which reliably does what I want, but you were able to use Refresh on the AbsentreportF (though verbally you said "requery")
Richard Rost on 4/1/2009: Harry, what's the time index? Nothing in Access is case sensitive. I might have just done that to make it easier for YOU to see it in the code?|
Richard Rost on 4/1/2009: Harry, you are correct. I'm used to working with NZ in VBA code, not queries. In VBA code, the DEFAULT value of that second parameter is ZERO if you're working with a number type (such as an ID) otherwise it's a zero-length string. MOST of the time I'm working with NZ it's for looking up IDs to see if records exist, so you don't need to specify it.|
From Microsoft's Help: If the value of the variant argument is Null, the Nz function returns the number zero or a zero-length string (always returns a zero-length string when used in a query expression), depending on whether the context indicates the value should be a number or a string. If the optional valueifnull argument is included, then the Nz function will return the value specified by that argument if the variant argument is Null. When used in a query expression, the Nz function should always include the valueifnull argument.
So, ideally, when working with queries, always make sure to specify the zero. Thank you, Harry.
Richard Rost on 4/2/2009: Harry, excellent question. I've added the answer to the Tips & Tricks section here:|
Kenneth Lange on 11/28/2010: Thank, Richard! I had been Wondring & pondering How I could use one form for Multiple uses. You demonstrated that to me it Access 325, video 2 at approx timestamp 9:34; Comparing & Syncing 2 Tables! Many Thanks to aGreat Instructor!!!|
Reply from Richard Rost:
Thank YOU for the kind words. Glad you enjoyed it.
Mubeezi Micah on 11/27/2011: Dear Richard,|
It seems there is an error at time index 3:42.
If you point db2 to an external db, then this line of code would be;
Set rs1 = db1.OpenRecordset("SELECT * FROM CustomerT WHERE CustomerID=" & rs2!CustomerID)
Perhaps you could try out and see. Otherwise, i am happy with the video.
Mubeezi Micah on 12/18/2011: Dear Richard,|
As i follow this video, i am using an external db. I need to create a query that will pick fields from both the external and the current db...such that i can import the new records. How can i do this? I cant figure it out yet.
You may want to read these articles from the 599CD News: