Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-20-2012, 03:19 PM   #1
amoghjain
Newly Registered User
 
Join Date: Aug 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
amoghjain is on a distinguished road
Dlookup return issues

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

amoghjain is offline   Reply With Quote
Old 08-20-2012, 03:22 PM   #2
bob fitz
AWF VIP
 
Join Date: May 2011
Location: Essex England
Posts: 3,531
Thanks: 52
Thanked 683 Times in 665 Posts
bob fitz has a spectacular aura about bob fitz has a spectacular aura about bob fitz has a spectacular aura about
Re: Dlookup return issues

You are using DCount() in your code but i think you need DLookup(). Try:
WorkDescription = DLookup("WorkDescription", "tblKEPCostCodes", "CostCode=" & CostCode)
__________________
Bob Fitzpatrick
Microsoft Community Contributor Award (2011)
If this helped, please click the scales at the bottom left of this posting.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Many thanks.


I have never failed. I have found a thousand ways that do not work!
bob fitz is offline   Reply With Quote
Old 08-20-2012, 05:56 PM   #3
amoghjain
Newly Registered User
 
Join Date: Aug 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
amoghjain is on a distinguished road
Re: Dlookup return issues

THANKSSS a lot. i think that was me being super dumb. but once again, thanks.

amoghjain is offline   Reply With Quote
Reply

Tags
dlookup access forms

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues with dlookup and saving a record bloodnfire Modules & VBA 2 05-03-2011 01:03 AM
Dlookup, Return last value Edgarr8 Forms 2 07-27-2009 01:50 PM
Dlookup issues! Mikkel Queries 6 10-14-2008 03:45 PM
DLookUp in Query Issues airforceruss Queries 5 02-17-2008 03:41 PM
DLookup Issues wchernock Modules & VBA 3 07-03-2007 02:16 PM




All times are GMT -8. The time now is 10:59 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World