New (old?) question on Dlookup in form (1 Viewer)

cclark9589

Registered User.
Local time
Today, 03:16
Joined
Sep 22, 2008
Messages
79
Actually have a two part question concerning my form and dlookup. Using Access 2007

I have a combo box for entering the name of the person placing an order. I have another field that looks for that person's email address (also have one for their phone number).

First question: how do I get rid of the #Error that shows on a new order form?

Second question: Can, and how, do I put this dlookup in VB rather than the Control Source? I'm thinking that would be faster, maybe not.

Form = ShirtOrders

NamesIDcbo Control Source = NamesID; Row Source = SELECT [qry_Names].[NamesID], [qry_Names].[FullName] FROM qry_Names ORDER BY [FullName];

Emaillkp Control Source =DLookUp("","qry_Names","[NamesID] =" & [Forms]![ShirtOrders]![NamesID])

I've looked in the forum and tried various other suggestions (Nz, IIf) to eliminate the #Error to no avail plus I've also tried some suggestions for putting the code to VB with the same result.

Keep in mind that I am a very basic user so any answers must be put in the simplest of terms (picture having to explain your answer to your pet gerbil!).

As always, thanks in advance for any suggestions.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:16
Joined
Aug 30, 2003
Messages
36,132
I think the speed would be similar, but your simplest and most efficient solution is actually to include the email field in the combo rowsource and then:

=ComboName.Column(2)
 

cclark9589

Registered User.
Local time
Today, 03:16
Joined
Sep 22, 2008
Messages
79
Thanks for the tip Baldy.
 

Users who are viewing this thread

Top Bottom