Computer Learning Zone CLZ Access Excel Word Windows

For me life is continuously being hungry. The meaning of life is not simply to exist, to survive, but to move ahead, to go up, to achieve, to conquer.

-Arnold Schwarzenegger
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Microsoft Access 311    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Dlookup
Robert Whishaw 
    
11 years ago
When we initially made the AddProductButton on click event using VBA  to perform dlookup's for notes, istaxable etc... it never worked for me so I just added those fields to the combo box & it worked great.
Now that we're adding more data to be looked up I'd really like to get to the bottom of why the VBA dlookup's aren't working.
Here's a list of all the combinations I've tried:

UnitCost = DLookup("UnitCost","ItemXVendorT","ItemID=" & ItemCombo)

UnitCost = DLookup("UnitCost","ItemXVendorT","ItemID=" & ItemCombo.Column(0))

UnitCost = DLookup("UnitCost","ItemXVendorT","ItemID" = ItemCombo)

UnitCost = DLookup("UnitCost","ItemXVendorT","ItemID=" & [Forms]![OrderF]![OrderDetailF].Form![ItemCombo])

UnitCost = DLookup("UnitCost","ItemXVendorT","ItemID" = [Forms]![OrderF]![OrderDetailF].Form![ItemCombo])

The field formats I'm looking up are all currency or number, no text fields involved.
I'm looking up UnitCost in the ItemXVendorT since I have a many to many relationship with products, vendors & their prices.
I've scanned forums for many hours without success.
Are there any common issues that I may be overlooking?
Any help would be much appreciated :)


Reply from Alex Hedley:

If you Debug.Print your ItemCombo what value are you getting?
Is your ItemID a Number Field
If it is text you would need "ItemID= ' " & ItemCombo & " ' " (i.e. wrapped in quotes)
Does your ItemXVendorT have values that match your ItemID
With it being a Junction Table are you likely to only have 1 ItemID

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

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/7/2026 4:11:02 AM. PLT: 1s