DLookups on Subforms in TabCtl Pages

  • Thread starter Thread starter OzPete
  • Start date Start date
O

OzPete

Hi all,

I have a form which successfully does a DLookup, when the form [Clients] is
opened in it's own right.

However, when I add that form as a subform on a Tabcontrol page, all it says
is '#error!'

Here's the DLookup

=DLookUp("[SexDesc]","Sex","[SexCode] =[Forms]![CLIENTS]![Sex]")

Assuming the form 'Clients' is now the subform on the TabCtl page, am I
missing something out of the syntax?

tia

OzPete
 
OzPete said:
Hi all,

I have a form which successfully does a DLookup, when the form [Clients] is
opened in it's own right.

However, when I add that form as a subform on a Tabcontrol page, all it says
is '#error!'

Here's the DLookup

=DLookUp("[SexDesc]","Sex","[SexCode] =[Forms]![CLIENTS]![Sex]")

Assuming the form 'Clients' is now the subform on the TabCtl page, am I
missing something out of the syntax?

Subforms are not considered "opened" and are thus not found in the Forms!
collection. You need to refer to it like this...

Forms!NameOfMainForm!NameOfSubFormControl.Form![Sex]

NOTE:
The name of the SubFormControl is *usually* the same as the form it refers
to, but that is not guaranteed. The syntax requires the name of the
control to work.
 
Back
Top