Access 2007-2016
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  
Courses - Microsoft Access 329
Description: Advanced Access Recordsets
Running Time: 76 minutes
Pre-Requisites: Access 328 very strongly recommended
Previous Lesson: Access 328
Main Topics: Purchase Orders, Receiving Inventory, Email POs, Bulk Email to Customers
Versions: 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 4/28/2019 to get a FREE upgrade to our Access 2010 version!
Click here for details


This class finished up working with the Purchase Orders that we started in Access 328. We'll begin by designing a printable PO report that you can send to your vendors.


We'll put a button on our PO Form to CLOSE the PO (mark that it was sent to the vendor).


We'll make options on the PO Form to see POs that NEED to be sent to the vendor, and that HAVE been sent to the vendor (we're still waiting on parts).


When the parts come in from the vendor, we'll have another button to mark them received.


Next you'll learn how you can have Access automatically generate an Email to send the POs electronically.


Finally, we'll go back to the Letter Writer that we built back in Access 204 and 205, and I'll show you how to use it to send Bulk Email.


Access 329 - Course Outline

1. Purchase Order Report, Part 1
Printable Purchase Order
Grab MyCompany Info from InvoiceR
PO Information
Line Item Information
SUM of Items Quantities
COUNT of Line Items
WhereStr to WhereBox
Print Selected PO

2. Purchase Order Report, Part 2
Print All Listed POs
NoData event if no purchase orders

3. Closing POs, Receiving Parts Part 1
Mark PO as Sent to Vendor
UPDATE Query With Just SQL
UPDATE Table SET Fields WHERE Condition
Mark PO as Parts Received

4. Closing POs, Receiving Parts Part 2
Hiding Unnecessary Buttons in Code
"Sent to Vendor" label on PO

5. Emailing Purchase Orders, Part 1
File > Send To > Mail Recipient as Attachment
HTML Format
Snapshot Format
Microsoft Access Snapshot Viewer
Text Format

6. Emailing Purchase Orders, Part 2
PO Report not Formatted Good for Email
Also Sends EVERY PO
Making a Unique PurchaseOrderEmailR

7. Sending Bulk Email to Customers
Add buttons for new forms to our menus
Add IncludeInEmails field to CustomerT
Bulk eMail List
Recordset to Send Bulk Email
Microsoft Outlook Email Security "Feature"



Student Interaction: Microsoft Access 329

Richard on 1/1/2008:  Purchase order report, Emailing POs to vendors, sending bulk email from Access to Outlook
Terry Hopper on 8/31/2009: I believe all I need to do to receive partial orders is to have a 'Yes/No' box next to the part being modified as 'Partial' or 'Not' correct? And write the code accordingly, correct? That should make the lesson simpler as opposed to doing an entire lesson on partial received items. Just a thought. I will try this.
Richard Rost on 4/12/2010: Out of the hundreds of students who have taken this course, only ONE has found this bug - and it's a good one. If you RECEIVE parts from a vendor, the Quantity On Hand in the Products table is never updated! Here's the updated code for the button (PartsReceivedButton) that fixes the problem. Just replace all of the code in the button with this:

' --------------------------------------------------------

If IsNull(POList) Then Exit Sub

If MsgBox("Are you sure you want to mark this " & _
"purchase order PARTS RECEIVED?", _
vbYesNoCancel) <> vbYes Then Exit Sub

' --------- MISSING BEGIN -----------------------
Dim db As Database
Dim rs1 As Recordset, rs2 As Recordset
Set db = CurrentDb()
Set rs1 = db.OpenRecordset("SELECT * FROM PurchaseOrderDetailsT WHERE PurchaseOrderID=" & POList, dbOpenSnapshot)
While Not rs1.EOF
Set rs2 = db.OpenRecordset("SELECT * FROM ProductT WHERE ProductID=" & rs1!ProductID, dbOpenDynaset)
rs2!QtyOnHand = rs2!QtyOnHand + rs1!Quantity
Set rs1 = Nothing
Set rs2 = Nothing
Set db = Nothing
' --------- MISSING END -------------------------

Dim S As String
S = "UPDATE PurchaseOrderT SET PartsReceived=TRUE " & _
"WHERE PurchaseOrderID=" & POList
DoCmd.RunSQL S


' --------------------------------------------------------

As you can see, everything between the "MISSING BEGIN" and "MISSING END" was just added by me. You need to create a Recordset loop to go through each item in the PODetails table and increase that product ID's quantity on hand.

I can't believe it has taken a year and a half for someone to catch this problem. This course was released in October of 2008. Wow.

Anyhow, thanks to Darl H. for catching this... and sorry it took me so long to post a solution.

Nick Fuller on 1/5/2011: I'm also very interested to see receiving partial parts and even an entire inventory setup :)
eddy geijselaers on 9/16/2011: Hi Rick,

Almost on the last lesson so far I like to ask you (as you asked to do) to make an lesson on "partial order shipping and returns". For this is quite normal to happen. As well as (if you are on the subject now) multiple vendors for any article. So there could be several "open orders" to several vendors who could suply the article we need.

This class for me was difficult. I checked all the code several times on several days but I cannot find where I am messing up. Even checked the tables used and their properties. (Also added the missing code).

So it is very tempting to just copy your db, because yours works. It might be because I am still working with XP and you with 2003.

I located the problem in the "BuildPOList" code. I can't get past an error message where Access asks for a variable on a yes/no field (it doesn't mention which). The event just doesn't work when changing the checkboxes. The labels don't work either. Still I am not able to find the difference between your code and mine.

Thanks in advance and looking forward to the next AC lesson eddy peanut geijselaers

Shams Momin on 12/11/2011: hi Richard I really like to make partial order in receiving order for my db

Ben Chua on 12/20/2011: As you mentioned, yeah partial order is interesting - but if you look at the table PurchaseOrderT, the default for PartsReceived is True - I think this is where you can adjust the quantity as partial if the return value is False.

Anyway while you are still deciding - I will play with the codes.

But I would really like to see is a RFID and BarCode Reader for Inventory. There are some merchandise comes in bulk as well. Most of them has a barcode already.

For warehousing delivery and receipts - this will also include RENTAL and RENTAL Contracts.

Len Jolly on 1/20/2012: Hi Richard
Well I've finished 329, I've inserted that missing code and all seems well, but after marking orders as received I'm still showing goods on order in ProductsT. I have been back through the lessons, but cannot find where I have gone wrong. Point me in the right direction please.

Gelo on 2/28/2012: Sir,
in the course outline you stated "Outlook security feature", i've been creating some basic access application at my work and im interested if you discussed also in this tutorial regarding auto email via VBA (my problem is the security prompt "....a program is trying to access") did you cover how to bypass this in your lesson?

Reply from Richard Rost:

Not really. This is by design. Microsoft doesn't want other programs sending spam via Outlook. You either have to deal with the prompt OR find an older version of Outlook that doesn't have it (I keep Outlook 2000 on one of my machines JUST for this purpose) OR use another email program. I have planned to create a seminar showing how to write your OWN email program using VBA. As soon as there are enough votes for it on the Waiting List, I'll put it together.

Gelo on 3/1/2012: Thanks for your prompt reply! i didn't expect that you personally give time for all comments and queries!!...btw, as ive said i already developing some applications via ms access but im interested in taking your VB tutorials does it cover vb-database programing? i suppose you are going to use access as your back end...are you planning to have MS SQL tutorial as well?? thanks! (i'm now searching within your site on how you deal clients abroad like from philippines)

Reply from Richard Rost:

I wish I had time to personally answer EVERY post. I do the best I can. I cover VBA programming for Access in my 301-329 lessons. My "Visual Basic" courses are for VB6 (soon to be upgraded to VB2010) and are a whole separate program. Yes, SQL Server is coming up too. Lots in the pipeline. Customers outside the US are no problem. Everything can be downloaded or viewed online.

Jim on 10/23/2012: Richard,

I know this is not news to you but I discovered that when I went to write some of the SQL statements ( I don't remember which ones exactly now) I got an error that had to do with the default library set in Access 2010 (which I use). I had to reset the library back to DAO 3.x to get the code to work without error. Shouldn't the new libraries funtion with SQL seamlessly or did I perhaps do something incorrectly? This issue went away when I put the DAO Library ahead of the ActiveX....

Thanks for you help as always.

Jim on 10/26/2012: Richard,

Perhaps an addendum to your code to increase on hand quantities after parts received...shouldn't we add a line of code to decrease the on order quantity in the inventory table by the same amount? I just added a line: "rs2!QtyOnOrder=rs2!QtyonOrder-rs1!Quantity..that seemed to work OK.

Deon Riley on 8/16/2013: Hi Richard,

Are you able to do something for us reference using bulk email using some VB or VBA programming that gets rid of the Outlook Security Warnings!

These warnings are annoying, and not condusive for running a small business.

If you are able to help with something to bypass these warnings would be so very much appreciated.

Best regards as always,


Reply from Richard Rost:

I'm going to do one better. I'm going to show you how to send email WITHOUT using Outlook. It's coming up in a new seminar very soon.

Deon on 8/16/2013: Richard - good evening,

This is absolutely wonderful news and I'm sure there are many members of your access community who can hardly wait for this seminar to come in as well.

Cheers for now,


Reply from Richard Rost:

Yep. It's on the SHORT list. I'll be working on it soon.

Robert Whishaw on 2/11/2016: I couldn't help but notice that the video doesn't cover the updating of "qtyonhand" units in ProductT, only how to update the purchase order from unreceived to received which is quite simple.
What kind of VBA recordset code do we need to update the "qtyonhand"?

I'd also really like to learn how to receive a partial order please.

Reply from Alex Hedley:

Was it not updated with this comment?

Shallena Ayers on 3/6/2018: Hello Richard, I am using Access 2013. I am getting an error message when I choose the null value for both check boxes in the purchase order form. I thought maybe it was my code but i downloaded your database and it gives me the same error so i am thinking it must be the version i am using vs the version that you used at the time. What can I do to the code to fix this? Here is the code that is highlighted in yellow when i click to debug:
Private Sub PODetailUpdate()

If IsNull(POList) Then
' no PO selected - show no records
Me.RecordSource = "SELECT * FROM PurchaseOrderT WHERE PurchaseOrderID=-1"
PurchaseOrderDetailsF.Form.RecordSource = _
"SELECT * FROM PurchaseOrderDetailsT WHERE PurchaseOrderID=-1"

ALSO... The code i copy and pasted from above to get the inventory to update after receiving the items does not work. I do not get any error messages ... but the inventory does not update... Thanks for your help! Shallena

Reply from Alex Hedley:

Does the sample db work on your machine?

There's a comment in the SI that explains the bug.
Bug in Access 329 Code
It's always useful to read the other student comments.

Shallena A on 3/10/2018: As I said in the original question... I did download the database and it gives me the same error when both check boxes are in the null position. And, I did read that post you mentioned... That code did not work either but I did figure out that I needed to add a line to the rs section to take the items out of quantity needed and that fixed that issue.

You may want to read these articles from the 599CD News:


Visual Basicindex
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
About Us
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Gift CDs
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP