Connecting Tech Pros Worldwide Forums | Help | Site Map

Using DLOOKUP Function to fill out Multiple Text Boxes ... Is this even possible

Newbie
 
Join Date: Dec 2006
Posts: 2
#1: Dec 12 '06
I have been having trouble with a simple Dlookup command that was Reccommended to me by a nice fellow named Vic, On the other hand I have statements like this that wont run they give me a run time error

Dim QuoteNumber As String


QuoteNumber = Me.txtQuoteNumber


Me.txtDealerNumber = DLookup("Dealer_Number", "Quote Table", "Quote_Number=" & txtQuoteNumber)



Me.txtCustomerName = DLookup("Dealer_Name", "Dealers Table", "Dealer_Number=" & txtDealerNumber)

I have a problem with the second DLOOKUP function because I dont think it may be possible to fill out multiple text boxes using multiple Dlookup commands. I have all of this running off a Command Button. The first part works fine It will get me my dealer number from my Quote table but the next few I am going to have to refrence from a different table (Dealers Table) And soemthing it not working.. Im trying to autopopulate
DealerName
Dealer Address
Dealer City
Dealer State
Dealer zip
Dealer phone
Dealer Contact

All refrenced off of the Dealer Number that I had retrieved from the last DLookup
and now Dealers Table
Any suggestions?

Newbie
 
Join Date: Dec 2006
Posts: 2
#2: Dec 12 '06

re: Using DLOOKUP Function to fill out Multiple Text Boxes ... Is this even possible


Nevermind Figured it out! apparently I had to have the last value in the DLookup function in " "

Thanks anyways
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#3: Dec 13 '06

re: Using DLOOKUP Function to fill out Multiple Text Boxes ... Is this even possible


String(text) values need to be enclosed in single quotes as follows:

Expand|Select|Wrap|Line Numbers
  1. Dim QuoteNumber As String
  2.  
  3.    QuoteNumber = Me.txtQuoteNumber
  4.    Me.txtDealerNumber = DLookup("Dealer_Number", "Quote Table", "Quote_Number='" & txtQuoteNumber & "'")
  5.  
  6.  
Mary
Reply