From: Jesse via AccessMonster.com on
Hello, I have a text box on a form and I would like data to be viewed from a
table. In the properties of the text box on the control source I place
=[Date Ran]![DT_TM_RAN]. I thought this would show the data in the DT_TM_RAN
field in the text box. But when I open the form it shows
#Name?
Can someone please direct me in the right direction to fix this issue. Thanks
for your time.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1

From: fredg on
On Wed, 17 Mar 2010 21:48:07 GMT, Jesse via AccessMonster.com wrote:

> Hello, I have a text box on a form and I would like data to be viewed from a
> table. In the properties of the text box on the control source I place
> =[Date Ran]![DT_TM_RAN]. I thought this would show the data in the DT_TM_RAN
> field in the text box. But when I open the form it shows
> #Name?
> Can someone please direct me in the right direction to fix this issue. Thanks
> for your time.

[Date Ran] is the name of the table?

=DLookUp("[DT_TM_RAN]","[Date Ran]")
will return the first value in the table.
If you wish a specific record's value returned you need to add a Where
clause to the above expression.

Assuming the form is displaying a unique record ID, and that field
([RecordID]) is a Number datatype, then something like this:

=DLookUp("[DT_TM_RAN]","[Date Ran]","[RecordID] = " & Me.[RecordID)

Look up the DLookUp function in VBA help and also
"restrict data to a subset of records"
for the correct syntax for Text or Date datatypes.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
From: golfinray on
I think the Dlookup function is what you want. Help on that function should
tell you exactly how to set that up for your situation.
--
Milton Purdy
ACCESS
State of Arkansas


"Jesse via AccessMonster.com" wrote:

> Hello, I have a text box on a form and I would like data to be viewed from a
> table. In the properties of the text box on the control source I place
> =[Date Ran]![DT_TM_RAN]. I thought this would show the data in the DT_TM_RAN
> field in the text box. But when I open the form it shows
> #Name?
> Can someone please direct me in the right direction to fix this issue. Thanks
> for your time.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1
>
> .
>
From: Jesse via AccessMonster.com on
DLookUp is exactly what i needed. I cant beleive i didnt think of that. Thank
you for you time and advise.

fredg wrote:
>> Hello, I have a text box on a form and I would like data to be viewed from a
>> table. In the properties of the text box on the control source I place
>[quoted text clipped - 3 lines]
>> Can someone please direct me in the right direction to fix this issue. Thanks
>> for your time.
>
>[Date Ran] is the name of the table?
>
>=DLookUp("[DT_TM_RAN]","[Date Ran]")
>will return the first value in the table.
>If you wish a specific record's value returned you need to add a Where
>clause to the above expression.
>
>Assuming the form is displaying a unique record ID, and that field
>([RecordID]) is a Number datatype, then something like this:
>
>=DLookUp("[DT_TM_RAN]","[Date Ran]","[RecordID] = " & Me.[RecordID)
>
>Look up the DLookUp function in VBA help and also
>"restrict data to a subset of records"
>for the correct syntax for Text or Date datatypes.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1