By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,035 Members | 1,543 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,035 IT Pros & Developers. It's quick & easy.

Dlookup help

P: 78
I currently have this code looking up the Vendor Name. I have just been asked to also have it lookup whether the vendor appears in a linked excel sheet tblVendorQualification and if the vendor does not appear in tblVendorQualification to not be able to save the record and to print a Message Box "Vendor Not Approved- Do Not Receive!"

Expand|Select|Wrap|Line Numbers
  1. Private Sub VendNo_AfterUpdate()
  2.  
  3.    Me.VendName = DLookup("[VendName]", "tblVendors", "[VendNo]=" & Me.VendNo)
  4.  
  5. End Sub
Mar 19 '07 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,364
I currently have this code looking up the Vendor Name. I have just been asked to also have it lookup whether the vendor appears in a linked excel sheet tblVendorQualification and if the vendor does not appear in tblVendorQualification to not be able to save the record and to print a Message Box "Vendor Not Approved- Do Not Receive!"

Expand|Select|Wrap|Line Numbers
  1. Private Sub VendNo_AfterUpdate()
  2.  
  3.    Me.VendName = DLookup("[VendName]", "tblVendors", "[VendNo]=" & Me.VendNo)
  4.  
  5. End Sub
I'm not sure how linked excel sheets work but try:
Expand|Select|Wrap|Line Numbers
  1. If DCount("*", "tblVendorQualification", "VendNo=" & Me.VendNo) = 0 Then
  2.    MsgBox "Vendor Not Approved - Do Not Receive!"
  3. End If
Mar 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.