Reference Issue

  • Thread starter Thread starter JHB
  • Start date Start date
J

JHB

Hi:

I have a simple question. Simple, that is, if you know the answer --
which I do not.

On a form I wish to display the last date the application was used,
which is stored (on closing) in a table called KeyDates. I have set a
Text Box which says : =[KeyDates]![LastClosed]. In theory this
should cause the date to appear in the box. The problem is that it
doesn't understand the reference and keeps just saying "Name?". I know
its a question of the syntax I am using, and am unable to figure out
what the syntax should be.

Can someone help, please?

John Baker
 
Hi:

I have a simple question. Simple, that is, if you know the answer --
which I do not.

On a form I wish to display the last date the application was used,
which is stored (on closing) in a table called KeyDates. I have set a
Text Box which says : =[KeyDates]![LastClosed]. In theory this
should cause the date to appear in the box. The problem is that it
doesn't understand the reference and keeps just saying "Name?". I know
its a question of the syntax I am using, and am unable to figure out
what the syntax should be.

Can someone help, please?

John Baker

You can't use this syntax to display a field in a table. Try

=DLookUp("[LastClosed]", "[KeyDates]")

assuming that the KeyDates table has one and only one record. If it has
multiple records (e.g. recording a history) and you want to see the maximum
value in the LastClosed field, use

=DMax("[LastClosed]", "[KeyDates]")

Both functions have an optional third paramter letting you apply criteria to
select one record among many - see the VBA online help for DLookUp or DMax for
details.
 
You need to look up the value by means of the DLookup function:

=DLookup("LastClosed","KeyDates")

Ken Sheridan
Stafford, England


I have a simple question. Simple, that is, if you know the answer --
which I do not.
On a form I wish to display the last date the application was used,
which is stored (on closing) in a table called KeyDates. I have set a
Text Box which says :   =[KeyDates]![LastClosed]. In theory this
should cause the date to appear in the box. The problem is that it
doesn't understand the reference and keeps just saying "Name?". I know
its a question of the syntax I am using, and am unable to figure out
what the syntax should be.
Can someone help, please?
John Baker

Thank you all very much...most helpful.

Regards

John Baker
 
Back
Top