Dlookup return issues (1 Viewer)

amoghjain

New member
Local time
Today, 08:51
Joined
Aug 21, 2012
Messages
2
Hey Guys,

I have been building a database for my team, but I ran into a simple issue which I just cannot resolve and i am hoping one of you experts here will be able to help me out. PLEASEEE..

I have a timecardinput table, costcode table and a timecardinput form. what i am trying to do is to make a timecardinput form, which updates the timecardinput table with costcode and its description.

User enters the costcode in the timecardInputForm but I want my form to autopopulate the description field, by using a dlookup on the costcode table. I have exausted all possible combinations but by dlookup only returns a 1, if the value is found and 0 otherwise.

not sure where I am going wrong, but any help is appreciated. i have watched dozens of youtube videos, and googled this with no help ;(

Once again thanks.

Public Sub CostCode_AfterUpdate()
WorkDescription = DCount("WorkDescription", "tblKEPCostCodes", "CostCode=" & CostCode)
End Sub
 

bob fitz

AWF VIP
Local time
Today, 14:51
Joined
May 23, 2011
Messages
4,717
You are using DCount() in your code but i think you need DLookup(). Try:
WorkDescription = DLookup("WorkDescription", "tblKEPCostCodes", "CostCode=" & CostCode)
 

amoghjain

New member
Local time
Today, 08:51
Joined
Aug 21, 2012
Messages
2
THANKSSS a lot. i think that was me being super dumb. but once again, thanks.
 

Users who are viewing this thread

Top Bottom