Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
compare tables
Hamish 
    
14 years ago
Hi Richard,

Just read Jim post, wishing you happy holiday's. My sincere apologies for the inconvenience, having to bother.

I have followed your instructions on how to use Dlookup with multiple criteria. Using the following Dlookup function I was able
to get the data that I needed.

Recordset example I used to gain the desired results:

    Set rs = db.OpenRecordset("Table1", dbOpenDynaset)
    
    rs.MoveFirst
    Do While Not rs.EOF
    rs.Edit
    rs!Sales = DLookup("Sales", "Table2", "PRSP=" & rs!PRSP & " AND Media='" & rs!Media & "'")
    rs.Update
    rs.MoveNext
    Loop
    

Question: I would like to know how do I get an average of what I'm trying to Dlookup?

Table 1

ProductID ItemNumber ItemDescription PRSP Media Sales Average
1 1234 Dunhill $3.00 rm 200 250
2 12345 Longbeach $4.00 rs 300 300
3 54321 horizon $3.00 sp 200 400



Table2 (Lookup Table)

ProductID ItemNumber ItemDescription PRSP Media Sales
1 1234 Dunhill $3.00 rm 200
2 12345 Longbeach $4.00 rs 300
3 54321 horizon $3.00 sp 200
4 1234 Dunhill $3.00 rm 150
5 12345 Longbeach $4.00 rs 250
6 54321 horizon $3.00 sp 300
7 1234 Dunhill $3.00 rm 250
8 12345 Longbeach $4.00 rs 350
9 54321 horizon $3.00 sp 500
10 1234 Dunhill $3.00 rm 400
11 12345 Longbeach $4.00 rs 300
12 54321 horizon $3.00 sp 600



Regards

Hamish




Reply from Richard Rost:

Well, there is no DAVERAGE function, but you could use DSUM to add up all the values, and then DCOUNT to divide, giving you an effective average.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

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: 5/17/2026 5:07:53 PM. PLT: 2s