Connecting Tech Pros Worldwide Help | Site Map

struggling with DLookup

Parasyke
Guest
 
Posts: n/a
#1: November 13th, 2006, 06:15 PM
I have a form (I won't bore you with the details of the necessity of
this, but), I need to have a textbox that uses DLookup to get a value
from a table with both being keyed to a common field "DMSID".
Because of various issues I need to get the textbox to simply display
the "PICTUREPATH" stored in the "PicturePaths" table based on another
value present on my form.

I'd like to use something like:
DLookUp("[PICTUREPATH]","PicturePaths","[DMSID]"=Forms!MainForm!DMSID)

But I don't have a clue how to get this to appear in the textbox... I
tried putting it in the DataSource property, and fiddled a little with
coming up with an event to populate the textbox, but nothing has
worked... Any clues for this newbie? Thanks!!!

kingston via AccessMonster.com
Guest
 
Posts: n/a
#2: November 13th, 2006, 06:45 PM

re: struggling with DLookup


Use the input control's AfterUpdate event with your expression:

Me.textbox = DLookUp("[PICTUREPATH]","PicturePaths","[DMSID]=" & Me.DMSID)

This assumes both textbox and DMSID are in the same form as the control
you're trying to set and that DMSID is a number. If DMSID is not a number
then you'll have to use something like:

Me.textbox = DLookUp("[PICTUREPATH]","PicturePaths","[DMSID]='" & Me.DMSID &
"'")

Parasyke wrote:
Quote:
>I have a form (I won't bore you with the details of the necessity of
>this, but), I need to have a textbox that uses DLookup to get a value
>from a table with both being keyed to a common field "DMSID".
>Because of various issues I need to get the textbox to simply display
>the "PICTUREPATH" stored in the "PicturePaths" table based on another
>value present on my form.
>
>I'd like to use something like:
>DLookUp("[PICTUREPATH]","PicturePaths","[DMSID]"=Forms!MainForm!DMSID)
>
>But I don't have a clue how to get this to appear in the textbox... I
>tried putting it in the DataSource property, and fiddled a little with
>coming up with an event to populate the textbox, but nothing has
>worked... Any clues for this newbie? Thanks!!!
--
Message posted via http://www.accessmonster.com

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dlookup Evaluating To Null ineedahelp answers 2 November 8th, 2006 01:33 AM
Having trouble with DLookUp in A97... MLH answers 4 November 13th, 2005 11:37 AM
My Dlookup is 'canceled' Thelma Lubkin answers 1 November 13th, 2005 11:20 AM
A new question with lookups Don Sealer answers 5 November 13th, 2005 06:38 AM