DLookup Error

Tiger6115

Registered User.
Local time
Today, 12:08
Joined
Jun 25, 2012
Messages
24
Hello Everyone, I am trying to get this code to work and would like and suggestions. I have a form InvestigatorDE with an unbound text field named Industry and a bound textbox named IndustryCode were users enter the industry code. I also have another table named 2012IndustryCode which contains the various codes and industry titles. I would like to have the Industry title appear in the unbound Industry textbox once a user enters the industry code in the IndustryCode field. I have tried a dlookup and get a data mismatch error.

Here's one of the codes i've tried:

Private Sub CONTACT_GotFocus()
Dim IndustryListing As String
Industry = DLookup("[NAICSTitle]", "2012IndustryCodeTable", "[NAICSCode] =" & Forms![InvestigatorDE]!INDUSTRYCODE)
End Sub

All of the fields are set as Text.


Any assistance is appreciated, Thanks.
 
Try this..
Code:
DLookup("[NAICSTitle]", "2012IndustryCodeTable", "[NAICSCode] = [B][COLOR=Red]'[/COLOR][/B]" & Forms![InvestigatorDE]!INDUSTRYCODE & "[B][COLOR=Red]'[/COLOR][/B]")
Since you said Industry code is Text..
 
Wow, Thanks that worked great!!!:D
 

Users who are viewing this thread

Back
Top Bottom