DLookups on Subforms in TabCtl Pages

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
 
R

Rick Brandt

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top