Connecting Tech Pros Worldwide Forums | Help | Site Map

struggling with DLookup

Parasyke
Guest
 
Posts: n/a
#1: Nov 13 '06
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: Nov 13 '06

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 Microsoft Access / VBA bytes