Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need little help please with some code 1

Status
Not open for further replies.

Margah

Programmer
Mar 21, 2004
15
US
Private Sub Part__Exit(Cancel As Integer)

Dim varPartDescription As Variant

varPartDescription = DLookup("PartDescription", "Inventory", "PartNumber = [Part]")


If (Not IsNull(varPartDescription)) Then Me![Description] = varPartDescription

End Sub
In the above code what I am tring to do is get the part desription to auto fill after the part number is entered.. what is happening is the part number is put in but the desription tha is being put in is the first description it comes to ( Record 1 ) when it should be using the one next tot he part Number.. any advice would be hel full

 
Have you tried this ?
varPartDescription = DLookup("PartDescription", "Inventory", "PartNumber='" & Me![Part] & "'")
If PartNumber is numeric, get rid of the single quotes.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank You very much it workedlike a champ.. Very much appreciated..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top