Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 22nd, 2007, 02:30 PM
Registered User
 
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to AidanEnos
Default DlookUp Macro failing

Ok,

This should work but doesn't and driving me nuts - not even sure where it's failing!!!

As I understand it, this code says...

I want the CustomerName field from the CustomersTable input to the CustomerName field on the active form and I want the CustomerName from the Entry in the CustomersTable that is in the record I just selected with the cboList box.

(I have it set to after Update on the cboList field)

DLookUp("CustomerName","CustomersTable","CustomerN ame = " & [cboList])

I know I'm missing some quotes or brackets or soemthing - I've tried a plethera of combinations - now show me the right choice!

 
Old November 23rd, 2007, 12:51 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

Welcome to P2P Mike-

I assume that cboList's data type is text. If so, concatenate another single quote into the first string and one after [cboList].

DLookUp("CustomerName","CustomersTable","CustomerN ame = '" & [cboList])& "'"

Your syntax is correct if cboList is a numeric (as opposed to text).

One of those "gotcha's"

HTH-
Loralee








Similar Threads
Thread Thread Starter Forum Replies Last Post
calling to xlam macro from macro inside xlsb SteveB Excel VBA 0 June 30th, 2008 06:43 PM
Dlookup problems jik VB How-To 0 February 15th, 2007 04:27 PM
Help with DLookup Devilboy13 Access VBA 4 August 30th, 2006 02:48 PM
Help - Dlookup function kk_sg Access VBA 3 August 23rd, 2006 11:30 AM
DLookup Teqlump Access VBA 1 August 9th, 2006 11:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.