| |
| |
|
Courses - Microsoft
Access 302 |
| Description: |
Advanced Access |
| Running Time: |
67 minutes |
| Pre-Requisites: |
Access 301 very strongly recommended |
| Versions: |
|
We use Access XP in this course,
but the lessons are valid for all versions of Access from 95 to 2003.
There are cosmetic changes in Access 2007. Order before 3/15/2010 to
get a FREE upgrade to our 2007 version when released!
|
|
|
|
|
| |
 |
Microsoft Access 302
Advanced Access Development
Product Table & Form, Select
Product From Combo Box, Column Property, GoToRecord, DLOOKUP, Error
Handling, More. 67 Minutes. |
|
|
|
AC302 Major
Topics |
- Product Table,
Form, Combo Box
- Select Products
From List
- Combo Box Column
Property
- DoCmd.GoToRecord
- DLOOKUP Function
- Basic Error
Handling
|
Access 302 continues our advanced Access
database development with VBA programming. We continue work on our sales
and order-entry system.
First we'll make a Product table and form so we can
pick from a list of products when making an order. We'll learn how to deal with
products that are non-taxable, or perhaps taxed at a different rate than normal
(for example, clothes in NY state have a different tax rate than most products).

Next we'll make a combo box to list all of our
products so that we can select a product when making an order. We'll put
this in the footer section of our Order Details subform.

We will then create a command button that we can
click on to get the data out of the combo box and put it up into the order
details. You will learn how to use the Column property of a combo box.

You will learn how to move the focus to a new
record in VB code, and how to set a field value. You will learn how to get
data from multiple columns in the combo box.

As great as combo box columns are, you can't use them for
everything. Next you'll learn about a powerful function called DLOOKUP
that you can use to retrieve ANY values from ANY tables or queries in your
database.

When we're finished with this lesson, we'll have added
much more functionality to our order-entry system by allowing the user to select
the product from a list of products instead of just typing it into the order.

|
Access 302 Outline
|
|
1. Product Information
Backup Access 301 Database
Create a Product Table
Non Taxable Products
Sales Tax Override
Put ProductID in Order Details table
2. Product Combo Box
Create a Product Combo
Remember the value for later use
Put Combo in OrderDetails Footer
Command Button to Add Product
Get Data from Combo Box Columns
Combo.Column() property
3. Get Data From Combo Box
ProductCombo.Column()
Move to a new record in VB code
DoCmd.GoToRecord
Accessing data from multiple columns
4. DLOOKUP
What is DLOOKUP
When should you use DLOOKUP
DLOOKUP to get values from tables
Me.Refresh
DLOOKUP Order Tax Rate from CustomerT
DIM a variable in VB
Basic Error Handling
On Error Resume Next
|
| |
|

Try a FREE Demo Lesson |
| |
| |
|
 |
Huge Discounts Available
When you purchase multiple classes together
Huge savings up to 50% off! Order Now. |
|
| |
Student Interaction:
Microsoft Access 302
|
Richard on 1/1/2007:
Continue Order Entry, Build Product Table & Form, Combo Box to Select Products, DLOOKUP, More VBA Functions |
|
Bob on 10/3/2008: Richard.I have learned so much with your series..thanks. However, I'm confused; I add a new customer; then go to orders - I see my new customer name. Then, after adding my products I hit the x to close the window and return to the customer form. I then return to the order form and my order is gone...happens no matter which lesson in 301-305 etc. If I want to really save my order it appears I need to click on the customer combo box and reselect my customer name. Note this is only for the FIRST order for that customer. Why does this happen and how can I avoid clicking on the customercombo? Sorry If I am missing something simple...this happens in my own application I am building too. |
|
Richard Rost on 10/3/2008: Bob, I just noticed something interesting, but kind of unrelated. While I was trying to figure out what's happening for YOU, I noticed that there needs to be a Me.Refresh in the "ADD ORDER" button on the CustomerF form. I just added a customer and hit ADD ORDER and did NOT see the customer in the dropdown because the customer record was still dirty (pencil - being edited). Make sure to add a Me.Refresh into that button. I'll add an addendum to the latest class about that.
As far as what's happening to YOU, I can't seem to recreate that problem. Are you adding the order from the ADD ORDER button on the CustomerF form? Or are you closing the CustomerF form and then going straight to the OrderF form?
In any case, it's the CustomerCombo box that creates the relationship between customers and orders. If you don't fill that in first, it won't save the order properly under that customer.
If you use the ADD ORDER button, it should automatically fill in the CustomerCombo for you. Aside from that little bug I mentioned before, everything appears to be working fine.
I anyone else experiencing this problem? |
|
Bob Veenstra on 10/10/2008: Richard: I got back at this, and after many tries and reloading of the lesson databases - I have been able to reproduce the error. As best as I could remember, here is the sequence. I think it has to do with the problem you addressed creating the order before its ready...thanks for helping: I can send my screen caps if you would like: used the 304 file.
1. Added me.refresh to add button on customerf form per your instructions.
2. opened customer list – clicked on id 7 Barker;
3. Open selected Customer selected sales rep Jane, and lead source Newspaper;
4. Show customer orders – none present closed window with x
5. On customerf clicked add new order
6. Order id 17 GamerSkum combo is already filled in as is order date;
7. Stopped by 'select a sales rep first'; OK - did that;
8. Add product – added t-shirt 17 closed with ‘x’
9. Back on customerf – clicked show customer orders worked fine;
10. Second Customer Alan Watson
11. Selected Joe for sales rep; screen26;
12. add new order
13. order form has sales rep joe; and tech rep joe...already filled in
14. Add product t-shirt - no pencil and order_id = 19 screen 27
15. closed with an x
16. returned to customers and ‘show customer orders’ – no orders screen 28
Seems to get the sales rep info from the first person’s order; then the second persons order carried over the data…too confusing for me….I am building a system that must be accurate...could you give a little more iinsight to avoid this problem. |
|
Richard Rost on 10/25/2008: Bob, i went through your directions step-by-step and I couldn't reproduce the problem. Did you make sure that you put a Me.Refresh in BOTH the "show orders" and "add new order" buttons? Try deleting all of the orders and order details in the system and start fresh. See if that helps. It worked perfectly for me and I tried it 3 times with the AC304.ZIP database. |
|
Bin Chen on 3/26/2009: Hi Richard,
I am having a hard time getting the Dlookup to work on my form per Access 302. I am trying to get the address field (a combobox) on my form to automatically populate by entering the Name. Here is my statment Address = DLookup("Address", "[PatientData Table]", "Name=" & NameCombo). I put this in the Address_AfterUpdate. But it doesn't work. Please help - Bin |
|
Richard Rost on 4/1/2009: Bin, first of all, you wouldn't put this in the Address_AfterUpdate. You can't look up the field you're updating. You'd put this in the Name_AfterUpdate. Second, I strongly recommend AGAINST naming any field "Name." It's a reserved word in Access. Finally, make sure you put quotes around any string in your parameters:
"[Name]='" & NameCombo & "'"
Hope this helps. If not, follow the lessons again and do exactly what I do. |
|
Ruth Spohr on 11/13/2009: 6:50 on the video shows error in Handbook (page 18), s is missing from Notes = DLookup etc. Whilst mentioning Handbook 302 on the footer it says Windows 120 instead of Access 305. Enjoying these lessons heaps. |
|
|
| |
| |
|
You may want to read these articles from the 599CD Blog: |
|
| |
|
 |
| |
| Do you have
questions about
Word, Excel, Access, Web Design, or computers in general? Just
ask us anything you'd like.
Click here
for assistance. |
|
|
|
|
|
| |
|

CLICK HERE for a FREE
lesson |

Order
your first 599CD course now.
Your Satisfaction is Guaranteed!
|
|
|
|
|
|
| |
|
|
|
|